Using 'dd' and 'gzip' to create a disk image. Restoring image: can't find lvm_root.
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: My distro changes somewhat often. I've used Gentoo, Ubuntu, Mandrake, Red Hat, and others.
Posts: 4
Rep:
Using 'dd' and 'gzip' to create a disk image. Restoring image: can't find lvm_root.
Hello,
I'm having some difficulty creating and restoring a disk image of a Fedora 15 desktop using dd and gzip. It seems the disk image was created successfully (i.e., no errors were generated), but when I restore the image on the same computer with a different (identical) hard drive, the system won't boot. The kernel appears to load, but then the Fedora splash screen goes away and I am dumped into a dracut prompt with the following:
---
Dropping to debug shell.
sh: can't access tty: job control turned off
dracut:/#
---
Here is a run down of the steps I used to create and restore the image, in case there is something I did wrong there. I wanted to create a compressed image with dd and gzip.
1. Boot the original Fedora 15 machine.
2. zero out white space on each partition. (dd if=/dev/zero of=/path/to/somebigfile.txt... on each partition) (and then rm somebigfile.txt... on each partition)
3. Reboot with a Fedora 15 LiveCD
4. Ensure the hard drive is not mounted.
5. Attach an external USB drive to store the compressed image.
6. dd if=/dev/sda |gzip -c9 > /mnt/usb-disk/Fedora15.img.gz
7. umount /mnt/usb-disk
8. Shutdown, swap hard drives with a clean drive, reboot with LiveCD.
9. mount the external USB drive
10. gunzip -c /mnt/usb-disk/Fedora15.img.gz | dd of=/dev/sda bs=1G
11. umount /mnt/usb-disk
12. Reboot without LiveCD.
Once the computer attempts to reboot, the Fedora splash screen comes up with the logo gradually filling up, then takes me to the dracut prompt mentioned above.
dmesg:
dracut: Scanning devices sda2 for LVM logical volumes LogVol00/lv_root LogVol00/lv_swap
dracut: inactive '/dev/LogVol00/lv_swap' [5.75 GiB] inherit
dracut: inactive '/dev/LogVol00/lv_home' [176.56 GiB] inherit
dracut: inactive 'dev/LogVol00/lv_root' [50.00 GiB] inherit
device-mapper: table: 253:1: sda2 too small for target: start=382339072, len=104857600, dev_size=311473952
dracut: device-mapper: resume ioctl failed: Invalid argument
dracut: Unable to resume LogVol00-lv_root (253:1)
dracut Warning: No root device "block:/dev/mapper/LogVol00-lv_root" found
dracut Warning: LVM LogVol00/lv_root not found
device-mapper: table: 253:2: sda2 too small for target: start=12060672, len=370278400, dev_size=311473952
device-mapper: table: 253:1: sda2 too small for target: start=382339072, len=104857600, dev_size=311473952
dracut Warning: No root device "block:/dev/mapper/LogVol00-lv_root" found
dracut Warning: LVM LogVol00/lv_root not found
If I look in /dev/mapper, there is a symlink for lvm_swap:
/dev/mapper/LogVol00-lv_swap -> ../dm-0
but nothing for ../dm-1 or ../dm-2. Also, dm-1 and dm-2 don't exist.
I ran the following LVM commands, which did restore the dm-1 and dm-2 entries under /dev, but these also generated errors.
# lvm vgscan
File descriptor 9 (/.console_lock) leaked on lvm invocation. Parent PID 877: sh
Reading all physical volumes. This may take a while...
Found volume group "LogVol00" using metadata type lvm2
# lvm vgchange -ay
File descriptor 9 (/.console_lock) leaked on lvm invocation. Parent PID 877: sh
device-mapper: resume ioctl failed: Invalid argument
Unable to resume LogVol00-lvm_home (253:2)
device-mapper: resume ioctl failed: Invalid argument
Unable to resume LogVol00-lv_root (253:1)
3 logical volume(s) in volume group "LogVol00" now active
I then verified that /dev/dm-? nodes existed for the three partitions
# ls /dev/dm*
/dev/dm-0 /dev/dm-1 /dev/dm-2
I created symlinks for -1 and -2 in /dev/mapper (dm-0 was already symlinked)
# cd /dev/mapper
# ln -s ../dm-1 LogVol00-lv_root
# ln -s ../dm-2 LogVol00-lv_home
I also created a symlink from for /dev/root
# cd /dev
# ln -s dm-1 root
Then exited to attempt a boot
# exit
This still returns me to the dracut prompt with the same message at the beginning of this post.
Could my .bz image just be corrupt? There were no errors when I created the image and no errors when I extracted it.
Distribution: My distro changes somewhat often. I've used Gentoo, Ubuntu, Mandrake, Red Hat, and others.
Posts: 4
Original Poster
Rep:
[SOLVED] Using 'dd' and 'gzip' to create a disk image. Restoring image: can't find lvm_root.
Turns out the two disks were a different size. I thought I grabbed identical drives, but I had a 250 GB image that I was trying to fit onto a 160 GB drive. I didn't think to look at the output of fdisk for the two drives because they came from two Dell computers that were supposed to have identical specs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.