1

I am currently working on a custom initrd based on the CentOS 6.7 (2.6) kernel with the following modules loaded.

The initrd is designed to backup files off a old RHEL system into memory, unmount the disk, wipe the disk and then finally dd a prebuilt CentOS system onto the disk.

The CentOS system was built on VMware then the vmdk was exported and converted into a raw format with qemu-img.

From testing the whole process works awesomely and once the dd is complete the system can be rebooted and start up fine.

The current blocker is that once the dd operation has completed, I can't mount the LVM disk to copy files back.

As you can see in the modules list the LVM drivers are there and are loaded, if I run a fisk -l it shows sda1 as the boot partition (Non-LVM) and sda2 as a LVM partition. When running pvscan -vvv it sees /dev/sda2 but says No label detected.

2
  • Without knowing exactly what you are doing, and what LVM layout you are getting, all we can do is guess.
    – vonbrand
    Commented Feb 18, 2016 at 1:13
  • This was answered by @Anthon suggesting that the Kernel would not be aware of the new partition layout and that I needed to invoke a rescan Commented Feb 18, 2016 at 3:30

1 Answer 1

1

Since you wipe the disk, the running kernel will not know about the partitions available.

You can run partprobe (as comes with the parted partitioning utility) to reload the correct partitioning info in your running kernel.

If you don't have partprobe (small discs not requiring parted?), you can use hdparm -z /dev/yourdrive as mentioned by @ko-dos

2
  • That work swimmingly! I tired looking for a way it could be done via invoking something in /proc so I wouldn't have to add more binaries but found that I already had hdparm which could do the same thing. Source: serverfault.com/questions/36038/… Commented Feb 17, 2016 at 9:10
  • 1
    @LiamHaworth Glad this pointed to the right direction. Didn't know about hdparm being able to do this.
    – Anthon
    Commented Feb 17, 2016 at 9:53

Not the answer you're looking for? Browse other questions tagged .