This question already has an answer here:

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.

marked as duplicate by Gilles, vonbrand, mdpc, user79743, garethTheRed Feb 18 '16 at 6:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Without knowing exactly what you are doing, and what LVM layout you are getting, all we can do is guess. – vonbrand Feb 18 '16 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 – Liam Haworth Feb 18 '16 at 3:30

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

  • 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/… – Liam Haworth Feb 17 '16 at 9:10
  • 1
    @LiamHaworth Glad this pointed to the right direction. Didn't know about hdparm being able to do this. – Anthon Feb 17 '16 at 9:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.