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.

SUMMARY
Does Ubuntu take advantage of multiple swap partitions on separate physical media, from a load sharing point of view? i.e. if one drive with a swap partition is burdened with i/o, will it utilise (other) swap space that resides on a different physical hard drive?

BACKGROUND
Building a headless home server (command-line only responses, please!). I usually put the o/s, the virtual/swap space and apps+data each on separate drives. While I think I've got directories and mount points clear (even managed to automount an NFS folder from a NAS), swap still seems a little hazy to me...

  1. The Ubuntu install sequence partitioned my main drive with LVM [still unsure if LVM was the best choice for a headless server; but this is not a question, just an observation]

  2. I've got two additional drives I'd like to use. While I see guides for GParted, detail regarding fdisk doesn't seem as thorough.

  3. I realise there's also the "swappiness" setting, but I'm more curious about the possible benefits if Ubuntu is sufficiently "device-aware" to take into account an i/o burdened device vs. an idle one, should it have multiple swap areas at its disposal.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

At boot mountall commands calls the swapon utility.

The swapon manpage says :

Calls to swapon normally occur in the system boot scripts making all swap devices available, so that the paging and swapping activity is interleaved across several devices and files.

As pages are interleaved across different devices one can assume that different swap spaces on different devices would performs better (like a RAID 0) than a single swap space on a single device.

My opinion is that tuning swap access is pointless, as when you got to a point where swap access is a critical resource, your system is almost unusable, disk access is 1000x slower than memory access.

Better tune the memory usage by removing unnecessary daemons, checking software parameters....

You should find useful informations on memory footprint here: http://linux-mm.org/LinuxMMDocumentation

share|improve this answer
add comment

While this doesn't actually answer my question regarding swap behaviour, I thought I'd at least share some useful commands when working with hard drives and partitions from the command-line.


!! WARNING !!

THE COMMANDS BELOW ARE EXAMPLES.   DELETING PARTITIONS, MODIFYING AND FORMATTING FILESYSTEMS CAN DESTROY DATA AND/OR PREVENT YOUR MACHINE FROM BOOTING.   MAKE BACKUPS.   USE AT OWN RISK.   TRY ON A MACHINE YOU DON'T MIND LOSING ALL DATA ON.
CAVEAT ADMIN.


Cheat sheet to quickly get a drive up as a single ext4 partition...

  1. View detected devices of class "DISK"

    lshw -C disk

  2. View existing partition table(s)

    fdisk -l

  3. Edit the partition table for my chosen device (in this case, "sdx")

    fdisk /dev/sdx

    Within FDISK, press:

    • d ...to delete the current partition

    • n ...to create a new partition

    • p ...to specify it as a PRIMARY partition

    • 1 ...to set it as the 1ST primary partition

    • w ...to write the changes.

  4. Display the new partition table:

    fdisk -l

  5. Format the new partition's filesystem as type ext4

    mkfs -t ext4 /dev/sdx1

  6. Remove reserved blocks (i.e. set to 0%) since this isn't / (root filesystem)

    tune2fs -m 0 /dev/sdx1

  7. Create a new directory where the new drive will mount into:

    mkdir /storage
    mount /dev/sdx1 /storage

  8. add mount to boot up, using /etc/fstab

    vi /etc/fstab

(refer to other guides on the contents of /etc/fstab and the various options available within it and, once again, be careful!)

share|improve this answer
    
As you said, this doesn't answer the question. If you think this information is valuable, you can post your own question like "how do I create and tune an ext4 filesystem?" then post this information as an answer there. –  ImaginaryRobots Nov 29 '13 at 16:36
    
Done: askubuntu.com/questions/384062 –  gth Nov 30 '13 at 5:15
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.