Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I still have two old ATA drives (one is only 8GB, one is somewhat defect) and I've been thinking about putting them into my PC and activating swap on them, too. What will be effect of this? Will my system spread data across the drives evenly so that swapping becomes faster?

share|improve this question
5  
Putting swap on defective disks is a great way of causing random panicks/lockups/general corruption. Putting swap on slow disks isn't a great idea either. –  Mat Jul 21 '12 at 8:15
1  
Also, if you wind up regularly using swap, then you can get much better performance improvements out of increasing ram memory than you'd ever get optimizing swap distribution. –  Shadur Jul 21 '12 at 14:29

1 Answer 1

up vote 7 down vote accepted

Firstly, using a slow or defective hard drive for swap is not a good idea. It's like having really slow or buggy memory in a way.

How your system spreads data across your swap partitions depends on the priority you give them in your /etc/fstab

As an example,

/dev/hda5 none swap sw,pri=2 0 0
/dev/hdb5 none swap sw,pri=1 0 0
/dev/hdc6 none swap sw,pri=3 0 0

Your system will use the partition with the highest priority first (in this case /dev/hdc6). Priorities go from 0 to 32767. You can assign the same priority to the different partitions and that will make your system use them equally (or spread the load across different drives). The main reason for this is that you want to use a faster (or less used but still fast) drive first, as it can have a major impact on your system.

You can change your system's tendency to write to swap by setting swappiness. More info here.

share|improve this answer

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.