Menu

#348 In Filesystem Maintenance page, the last partition listed by blkid is displayed with false informations if a dm partition exists

fixed
nobody
None
2014-11-08
2014-10-12
schodet
No

What steps will reproduce the problem?

  1. Create a LVM or crypted partition
  2. Assign it a label
  3. Create a second one

What is the expected output?

The second partition should not have any label.

What do you see instead?

I see the label of the first partition.

What browser and operating system are you using on your computer?

Iceweasel on Debian.

Please provide any additional information below

In the diskmaint.cgi script, there is:

# somehow blkid only reports /dev/mapper/ devices, not /dev/dm-* ones.
# not blkid cache problem, is because /dev/mapper/* and /dev/dm-* has the same major,minor?
blk=$(blkid -s LABEL -s TYPE) 
blk="$blk $(blkid -s LABEL -s TYPE /dev/dm-[0-9]*)"

(Actually on my NAS, it reports /dev/dm-* ones)

Here is the resulting "$blk" on my NAS:

/dev/loop0: TYPE="squashfs"
/dev/sda1: TYPE="swap"
/dev/sda2: TYPE="ext4" LABEL="system"
/dev/sda3: TYPE="lvm2pv"
/dev/dm-0: LABEL="data" TYPE="ext4"      
/dev/dm-1: TYPE="crypt_LUKS" 
/dev/dm-2: TYPE="ext4" LABEL="cdata" 
/dev/dm-3: TYPE="ext4"  /dev/dm-0: LABEL="data" TYPE="ext4"
/dev/dm-1: TYPE="crypt_LUKS" 
/dev/dm-2: TYPE="ext4" LABEL="cdata"
/dev/dm-3: TYPE="ext4"

Note that the second /dev/dm-0 is on the same line as the first dm-3.

When sed is used later to parse "$blk" for /dev/dm-3, it returns:
LABEL="data" TYPE="ext4"
TYPE="ext4"

When evaluating, LABEL is assigned with wrong value.

A fix could be to run blkid like this (if the comment above still holds):

blk=$(blkid -s LABEL -s TYPE; blkid -s LABEL -s TYPE /dev/dm-[0-9]*)

Discussion

  • João Cardoso

    João Cardoso - 2014-11-08
    • status: open --> fixed
     
  • João Cardoso

    João Cardoso - 2014-11-08

    Actually on my NAS, it reports /dev/dm-* ones

    Yes, it also works for me now, so the best fix is to just comment the second 'blk="$blk ...'

    Fixed by SVN commit 3120:

    filesystem webui: fix ticket 348

    In Filesystem Maintenance page, the last partition listed by blkid is
    displayed with false informations if a dm partition exists

    Thanks

     

Log in to post a comment.