[SGVLUG] Swap labels

Dustin laurence at alice.caltech.edu
Sun Sep 18 11:54:05 PDT 2005


Someone asked me privately about my side comment that you can label swap 
partitions, so there are probably a few other people who might like to 
know but didn't ask.  So here it is:

"mkswap -L" labels a swap partition.  I think it only does this at 
creation time, so you want to make sure you're not swapping on that 
partition or things could be...bad.  So if partition number N on disk
X is the one you want to label "SWAP", you'd do this (as root, obviously):

	# swapoff /dev/hdXN
	# mkswap -L SWAP /dev/hdXN
	# swapon /dev/hdXN

then you want to mount it by label at the next boot (otherwise labels 
don't buy you anything).  This works exactly the same as for filesystems:
you replace a line like

	/dev/hdXN	none	swap

in fstab with a line like

	LABEL=SWAP	none	swap

Then you probably want to reboot just to make sure that if you did 
anything wrong you find out about it while you still remember what you 
did. :-)

Dustin




More information about the SGVLUG mailing list