Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed ubuntu 11 onto a 30GB SSD (10 & 17GB partitions - / and /home respectively) with a 1TB and 2TB disk drive for data/large programs and I did not want to subject the SSD to swap activity when I installed Ubuntu over the C & D drive volumes used by my previous win2k setup (assuming I'd be able to create a seperate swapfile on the first logical 10GB FAT32 volume at the very start of the 1TB drive alongside the pagefile.sys windows swapfile).

Googling for info on setting up a swapfile, it's not clear whether or not I can do this and I would like to know if I have to edit the disk drive partitions to create a dedicated swap partition (in which case, is it possible or even recommended to have mixed FS types, such as a 4GB swap preceeding a 1 or 2 TB logical NTFS volume?).

I'm asking because I plan to run win2k and winXP VMs using VirtualBox and want to retain the NTFS and FAT32 disk volumes intact as much as possible.

TIA, johnny-b-good

share|improve this question
    
FWIW, swapping is so misunderstood. Depending on how much memory you have there could very well be little swapping at all. Say with a basic Ubuntu install with 8G (or even 4G) depending on use, in general, there's not much swapping. By the time your SSD is worn you'll be able to get a new one for 1/2 the price, or less. I create my swap partitions on my SSDs (8 at present) and have seen no adverse performance nor early wear. –  bdowning Jan 23 '12 at 20:20
add comment

1 Answer 1

You can have your swap on a file, but keep in mind that the filesystem on which the file resides has to already be mounted for the swapfile to be found. I'd try listing the fat32 filesystem before the swapfile in /etc/fstab. By the way, to specify a swapfile instead of a partition something like this works in fstab:

/media/fat32-partition/swapfile.swp     none    swap    sw   0  0

If not, you can always add swapon -a to /etc/rc.local to re-enable the swapfiles once all the boot scripts are run, at which point all the filesystems should be mounted and visible.

Finally, do keep in mind that going through the filesystem layer will slow down access to your swap file. If at all possible, I'd strongly recommend trying to add a dedicated swap partition.

share|improve this answer
    
The order doesn't matter; mountall is smart enough to figure out that one needs mounted before the other, as long as both are listed in fstab at all. Also it is an old myth that swap files are any slower - they are not. The kernel maps the location of the file at swapon time and after that, bypasses the fs. –  psusi Jan 18 '12 at 17:04
    
roadmr, thanks for your very quick response. I'm inclined to edit the partitioning spaces on the large spinning drives to create swap partitions, rather than use a swapfile, but I've read that mixing partition types on any one disk might not be a clever idea so I'd appreciate any comments in this regard. –  Johnny-b-good Jan 18 '12 at 17:50
    
psuis, I appreciate your comment regarding the myth over swapfile access not being as fast as a swap partition. However, I think there is an element of truth to this since a swapfile might well be created out of fragmented space causing the access time to be increased. A swap partition has the charm of eliminating this unknown from the equation. I just need to know whether adding a swap partition in front of a logical NTFS partition is a workable proposition or not. –  Johnny-b-good Jan 18 '12 at 17:58
    
I don't think having the swap partition in front of the NTFS one should give trouble. Haven't tried though :) –  roadmr Jan 18 '12 at 19:49
    
roadmr, thanks for the follow up comment. The more I consider this, the more I'm inclined to think that having a 4GB swap partition in front of a logical 1 or 2 TB ntfs disk volume will be perfectly ok. Since I don't need (or, indeed, desire) to make any of these ntfs volumes bootable, the old 1024 cylinder boundary limitation doesn't represent any problem whatsoever. BTW, although I recycled the original partition spaces used by C & D drives in the win2k install in order to preserve the EB alignments, I did reformat them both as Ext3 volumes (Ext4 has fragmentation issues). –  Johnny-b-good Jan 18 '12 at 23:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.