[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: labeling swap partitions, a question

On 03/24/2011 10:49 AM, Paul E Condon wrote:
> I'm looking into using partition labels on my wheezy boxes. In the course
> of doing this, I notice that one can uses a partition label to specify
> which partition is to be used for swap in the swapon command and one can
> specify a label string to be written onto a partition in mkswap. But, I
> can't find a way to read/verify whether there is already a label on an
> existing swap partition. Is there a way to read? How?
grep swap /etc/fstab
LABEL=swap1       none            swap    sw,pri=1        0       0
LABEL=swap2       none            swap    sw,pri=1        0       0

/sbin/swapon -s
Filename                Type            Size    Used    Priority
/dev/sda2               partition       979956  7004    1
/dev/sdb2               partition       979956  7000    1

/sbin/blkid -o value -s LABEL /dev/sd[ab]2

If you don't use a specific /dev/??? value, blkid will print all LABEL
values.  If you want the UUID, use that in place of the LABEL argument
to the -s option.

You may need to be root to run swapon.  You will need to be root to run
blkid as it needs to read disk devices.

Bob McGowan

Reply to: