LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-23-2012, 07:01 AM   #1
skiman1979
LQ Newbie
 
Registered: Dec 2009
Location: Earth
Distribution: My distro changes somewhat often. I've used Gentoo, Ubuntu, Mandrake, Red Hat, and others.
Posts: 4

Rep: Reputation: 0
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.

Thanks in advance for any help.
 
Old 02-23-2012, 08:55 AM   #2
oso_togari
Member
 
Registered: Jan 2008
Distribution: SOLARIS 9, RHEL4
Posts: 39

Rep: Reputation: 0
Hi,

it may be corrupt... another idea its that the HDD its not identical, and the structure of lvm complaints about that.

can you compare the "fdisk /dev/sda --> p" output in both orig. and dest.?

regards
 
Old 02-25-2012, 05:42 AM   #3
skiman1979
LQ Newbie
 
Registered: Dec 2009
Location: Earth
Distribution: My distro changes somewhat often. I've used Gentoo, Ubuntu, Mandrake, Red Hat, and others.
Posts: 4

Original Poster
Rep: Reputation: 0
[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.

I'll leave my Geek Badge at the door.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Single Disk Image from 5 disk RAID 5 setup? slimjim Linux - Software 3 12-13-2011 05:34 AM
How to create disk image for Fedora 14? TigerLinux Fedora 2 12-17-2010 06:29 AM
Using dd and gzip to create hard drive image but image is bigger than hard drive? banz Linux - Software 3 11-22-2008 04:25 AM
qemu create disk image kpachopoulos Linux - General 3 11-29-2005 10:49 AM
How to create disk image with Linux? zaoka Linux - Software 3 07-14-2005 03:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration