Swap file in cache

Request new features that might make using Gentoox better.
Post Reply
s00pcan
Newbie
Posts: 8
Joined: Sun Nov 14, 2004 3:19 pm

Swap file in cache

Post by s00pcan »

Wouldn't it make sense to create a swap file in the cache instead of storing one on the E or F partitions all the time? Unless of course it takes too long to create the swap file, then this would just make startup slower.
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

I'm not sure that this is possible, I doubt that the tools required to make the swap file are available at boot time. I suppose you could create and mount the swap using a script in local.start rather than using the fstab. Try adding this to you /etc/conf.d/local.start

Code: Select all

dd if=/dev/zero of=/mnt/fatx/y/swap bs=1024k count=256
mkswap /mnt/fatx/y/swap
swapon /mnt/fatx/y/swap
and add this line to /etc/fstab

Code: Select all

/dev/hda52         /mnt/fatx/y        fatx        noatime            0 1
create the mount point

Code: Select all

mkdir /mnt/fatx/y
Add this to /etc/local.stop

Code: Select all

swapoff /mnt/fatx/y/swap
rm -rf /mnt/fatx/y/swap
reboot and see if it works, if so try removing the swap line from fstab then reboot and see if it still works.
If you keep an open mind, will your brain fall out?
s00pcan
Newbie
Posts: 8
Joined: Sun Nov 14, 2004 3:19 pm

Post by s00pcan »

Well I'm waiting until christmas when I get a newer harddrive to install linux again (never got the rootfs resized to 2gb), but I just had this idea that seemed like a good way to save space and wanted to make sure it got written down. So someone else would have to test this.
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

It could easily be made to be on a cache partitions... but they are extremely volatile. Games may decide to wipe swap partitions at any time. Creating the swap at boot isnt really an option as it takes about 30 seconds to initialise it. I have definitely thought this over before :)
The original Xbox adaptation of Gentoo
Post Reply