[COLUG] How to read label of a swap partition

Brett Stauffer brett at bnbstauffer.net
Mon Aug 27 08:17:19 EDT 2007


On Fri, 2007-08-24 at 17:58 -0400, jep200404 wrote:
> How can one read the label of a swap partition? 

"blkid" is supposed to list block device attributes, including labels.  

I say "supposed to", because it doesn't seem to work on RHEL 4 (or
CentOS 4):

        [root at h ~]# cat /etc/*-release 
        Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
        [root at h ~]# lvcreate -n lv_swaptest -L 100M vg_local
          Logical volume "lv_swaptest" created
        [root at h ~]# mkswap -L swaptest /dev/vg_local/lv_swaptest 
        Setting up swapspace version 1, size = 104853 kB
        [root at h ~]# blkid /dev/vg_local/lv_swaptest 
        /dev/vg_local/lv_swaptest: TYPE="swap" 
        
It does work on SUSE 10.2, though:

        h:~ # cat /etc/*-release 
        openSUSE 10.2 (i586)
        VERSION = 10.2
        LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32"
        h:~ # lvcreate -n lv_swaptest -L 100M vg_sys
          Logical volume "lv_swaptest" created
        h:~ # mkswap -L swaptest /dev/vg_sys/lv_swaptest 
        Setting up swapspace version 1, size = 104853 kB
        LABEL=swaptest, no uuid
        h:~ # blkid /dev/vg_sys/lv_swaptest
        /dev/vg_sys/lv_swaptest: LABEL="swaptest" TYPE="swap" 
        
I suppose this could be complicated by the fact that I'm testing with
LVM LVs.  I don't have a system to easily test a "hard" partition with.

        
--brett




More information about the colug432 mailing list