Swap Space Labels

A few issues today with a machine that had been left to boot with its swap space on the SAN. So I wanted to tell the machine to use the swap space on the local disk so I could refer to it in /etc/fstab by its label. So I tried:

e2label /dev/sdf3 SWAP-local

which didn’t work as e2label is specifically for ext2/ext3. So:

mkswap -L SWAP-local /dev/sdf3

Created the swap space and assigned the label. But I didn’t want to reboot until I was sure the correct swap space would be used so I checked with:

swapon LABEL=SWAP-local

Which informed me the device was busy – must have been started with the mkswap command! So I checked again with:

swapon -s

Which gives a summary of the swap being used and this showed my partition sdf3 being used. Happy days and a reboot showed things back to normal. For reference swapon -a will read from /etc/fstab for swap and the /etc/fstab now uses:

LABEL=SWAP-local        swap                    swap    defaults        0 0

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>