Opened 4 years ago

Closed 4 years ago

#696 closed defect (fixed)

LVM check

Reported by: vicgat Owned by: bruno
Priority: normal Milestone: 3.0.4
Component: mondo Version: 3.0.3
Severity: normal Keywords: LVM
Cc: vicgat, ddiaz


About mondo 3.0.3, in libmondo-devices.c, line 1909 :

mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);

I think that it should be :

mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);

Change History (4)

comment:1 Changed 4 years ago by vicgat

About: grep -E \"/dev/mapper/%s-

If we have for example /dev/mapper/XXXXX-YYYYY then %s=XXXXX and "grep /dev/mapper/%s-" will work.

But it should be replaced by %s because %s- will not work if the name is a wwid (or an user alias) in /dev/mapper (with multipath it can be defined in "multipaths" section of /etc/multipath.conf) ; because there could be no '-' in the alias, for example:


or : /dev/mapper/vgdbdisk01

if we have in /etc/multipath.conf :

multipaths {
        wwid    36050468008b0423a0000400003ab0000
        alias   vgdbdisk01
Last edited 4 years ago by vicgat (previous) (diff)

comment:2 Changed 4 years ago by vicgat

Also I don't see why %%s in the awk, instead, it should be %s

Example, with %%s we get a wrong result:

# mount 2>/dev/null|grep -E "/dev/mapper/VGDD" |awk '{printf("%%s ", $3)}END{print ""}'
%s %s %s %s 

And with %s we get the good result:

# mount 2>/dev/null|grep -E "/dev/mapper/VGDD" |awk '{printf("%s ", $3)}END{print ""}' 
/mnt/data0 /mnt/data1 /mnt/data2 /mnt/data3
Last edited 4 years ago by vicgat (previous) (diff)

comment:3 Changed 4 years ago by vicgat

So two modifications should be done, if you agree.

Last edited 4 years ago by vicgat (previous) (diff)

comment:4 Changed 4 years ago by bruno

  • Resolution set to fixed
  • Status changed from new to closed

I agree with the first one, not the second. For the second in C, you need to prepend a % by another % sign to be correct, thus the double %%

Wrt the first part, it is now in rev [3152], thanks for tracking it down !

Note: See TracTickets for help on using tickets.