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

Bug#377391: Extremely irritating libparted error message during LVM on RAID setup



Package: partman-lvm
Version: 41
Severity: important
Tags: patch, pending

After a RAID device has been set up and that device has been selected "for 
use with LVM", the following message is displayed when changes to devices 
and partitions are committed to disk before configuring LVM:
   "Error informing the kernel about modifications to partition
    /dev/md/0p1 -- Invalid argument.  This means Linux won't know about
    any changes you made to /dev/md/0p1 until you reboot -- so you
    shouldn't mount it or use it in any way before rebooting."

For Sarge installations a different, but similar message was shown:
   "The kernel was unable to re-read the partition table on /dev/md/0
    (Invalid argument).  This means Linux won't know anything nothing
    about the modifications you made until you reboot.  You should reboot
    your computer before doing anything with /dev/md/0."

The basic cause is that partitions on a software RAID device are not 
really supported by parted. I did some tests using parted from shell with 
very inconsistent results (changes are sometimes committed, but 'parted 
print' does not show them while 'fdisk list' does; kernel/udev does not 
create /dev/md/0p1 device nodes).

After investigation the only reason partman tries to commit changes at all 
turned out to be that the script update.d/21lvm_sync_flag sets the "lvm" 
flag for a "dummy" partition that is created by partman in 
init.d/31md-devices.

Earlier hacks in partman-lvm have already made sure that partman itself 
does not rely only on the flag, but sets "method" instead (based on the 
output of 'pvdisplay') in case of LVM on RAID. In line with this and as 
the flag is never actually written anyway, it seems safe not to try 
setting the flag if the lvm device is on a /dev/md/X device.

The following patch implements this.
--- update.d/lvm_sync_flag      (revision 38772)
+++ update.d/lvm_sync_flag      (working copy)
@@ -24,6 +24,16 @@
        method=$(cat $id/method)
 fi

+# As setting flags on RAID devices does not work and causes errors from
+# libparted, do not attempt to sync flags in case of LVM on RAID.
+# This is in line with the hacks in init.d/lvm and undo.d/lvm.
+if [ -f device ]; then
+       case $(cat device) in
+           /dev/md/*)
+               exit 0 ;;
+       esac
+fi
+
 has_lvm=no
 flags=''
 open_dialog GET_FLAGS $id

Attachment: pgp_qlAu51CkD.pgp
Description: PGP signature


Reply to: