# mkswap and label creation

## Kobboi

I am using filesystem labels to have them distinguished by blkid in an genkernel generated initramfs. This mostly works, but on some setups I see the following problem:

```

nbbeijing20 ~ # blkid

/dev/sda1: SEC_TYPE="msdos" LABEL="DellUtility" UUID="07D7-0812" TYPE="vfat" 

/dev/sda2: LABEL="autodistro-root" UUID="7ad07987-818e-4cfc-b745-4a7bfab284f2" SEC_TYPE="ext2" TYPE="ext3" 

nbbeijing20 ~ # mkswap /dev/sda1 -L autodistro-swap

Setting up swapspace version 1, size = 987960 KiB

LABEL=autodistro-swap, UUID=b7bf3fde-de42-4a19-a4c6-d7f7bf0868b5

nbbeijing20 ~ # blkid

/dev/sda1: SEC_TYPE="msdos" LABEL="DellUtility" UUID="07D7-0812" TYPE="vfat" 

/dev/sda2: LABEL="autodistro-root" UUID="7ad07987-818e-4cfc-b745-4a7bfab284f2" SEC_TYPE="ext2" TYPE="ext3" 

nbbeijing20 ~ # mke2fs /dev/sda1 -L testinglabel

mke2fs 1.41.3 (12-Oct-2008)

Filesystem label=testinglabel

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

61824 inodes, 246991 blocks

12349 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=255852544

8 block groups

32768 blocks per group, 32768 fragments per group

7728 inodes per group

Superblock backups stored on blocks: 

   32768, 98304, 163840, 229376

Writing inode tables: done                            

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

nbbeijing20 ~ # blkid

/dev/sda1: LABEL="testinglabel" UUID="8edb071a-a37d-47f5-937b-16a68aa924d2" TYPE="ext2" 

/dev/sda2: LABEL="autodistro-root" UUID="7ad07987-818e-4cfc-b745-4a7bfab284f2" SEC_TYPE="ext2" TYPE="ext3" 

nbbeijing20 ~ # mkswap /dev/sda1 -L autodistro-swap

Setting up swapspace version 1, size = 987960 KiB

LABEL=autodistro-swap, UUID=2748bdcd-5777-4130-9319-e868b8c48230

nbbeijing20 ~ # blkid

/dev/sda1: LABEL="autodistro-swap" UUID="2748bdcd-5777-4130-9319-e868b8c48230" TYPE="swap" 

/dev/sda2: LABEL="autodistro-root" UUID="7ad07987-818e-4cfc-b745-4a7bfab284f2" SEC_TYPE="ext2" TYPE="ext3" 

```

So as you can see, I cannot set the label of the swap partition (even though it is formatted correctly and I can already use it as swap space) before first trying something else. Anyone any idea what is going on? It's the mkswap from util-linux-2.14.2.

----------

## unixbhaskar

would you mind to try "e2label" on that particular slice?

----------

## LesCoke

 *Kobboi wrote:*   

> 
> 
> ```
> 
> nbbeijing20 ~ # blkid
> ...

 

Label appears to be visible the second time around, not certain what happened on the first, except maybe the partition information hadn't reloaded yet.

Les

----------

