2

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.

2 Answers 2

3

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

-2

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!)

2
  • 1
    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. Nov 29, 2013 at 16:36
  • Done: askubuntu.com/questions/384062
    – gth
    Nov 30, 2013 at 5:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .