LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-09-2010, 01:27 AM   #1
tolsty7
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Restore LVM disk from image, made by dd


I hav LVM:

Code:
#lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup01 -wi-a- 145.03g
  LogVol01 VolGroup01 -wi-a-   3.91g
And backup of LogVol00, that was made like this:
Code:
dd if=/dev/mapper/VolGroup01-LogVol00 bs=64K | gzip -c |  > /mnt/usb/backup.img.gz
when i try to:
Code:
gunzip -c /mnt/usb/mapper_VolGroup01-LogVol00.img.gz | dd of=/dev/mapper/VolGroup01-LogVol00 conv=sync,noerror bs=64K
there is no errors, but when i try to mount recovered partition, i see an error:
Code:
# mount /dev/mapper/VolGroup01-LogVol00 /mnt-user/00/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/VolGroup01-LogVol00,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
I need that partition alive. Please, help me with it.

Last edited by tolsty7; 07-09-2010 at 02:52 AM.
 
Old 07-10-2010, 06:07 PM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
Did you find anything useful in syslog or check dmesg output as suggested when the mount failed?
When I tried this and checked dmesg output it reports: EXT3-fs: no journal found.
(You did not specify what filesystem was on your .img.gz so I went with ext3.)


Edit 1:
UPDATE:
FAILURE:
Code:
dd if=/dev/VolGroup01/LogVol00 bs=64K | gzip -c > /mnt/usb/backup.img.gz

gzip -d -c /mnt/usb/backup.img.gz | dd of=/dev/VolGroup01/LogVol00 conv=sync,noerror bs=64K

mount /dev/VolGroup01/LogVol00 /mnt-user/00/
SUCCESS
Code:
dd if=/dev/VolGroup01/LogVol00 bs=64K | gzip -c > /mnt/usb/backup.img.gz

gzip -d -c /mnt/usb/backup.img.gz > /mnt/usb/backup.img

dd if=/mnt/usb/backup.img of=/dev/VolGroup01/LogVol00 conv=sync,noerror bs=64K

mount /dev/VolGroup01/LogVol00 /mnt-user/00/
Not sure why decompressing first and then using dd on decompressed .img to place it on the LV works while the decompression to stdout and pipe to dd fails, but worth a shot to see if it works for you if you have the ~145.03g free somewhere to stage it.




Edit 2:

OK, the bs=64K seems to be what is breaking it for me. When I use bs=512, while it takes substantially longer, I do not get 'No space left on device' and I am able to successfully mount the filesystem on it.

Last edited by rayfordj; 07-10-2010 at 07:13 PM.
 
Old 07-10-2010, 06:38 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,205

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
That looks suspiciously like you are over-writing a lv on a running system ...
I'm thinking you'll need to rescan those (LVM) devices - search here on LQ for pvscan and vgscan (and vgchange).
 
Old 07-10-2010, 07:15 PM   #4
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
Try this first:
Code:
gunzip -c /mnt/usb/mapper_VolGroup01-LogVol00.img.gz | dd of=/dev/mapper/VolGroup01-LogVol00 conv=sync,noerror bs=512
If that does not work and you have the space to stage the dd img somewhere before writing it to /dev/VolGroup01/LogVol01, try the steps in my previous post under "SUCCESS".
 
Old 07-12-2010, 02:00 AM   #5
tolsty7
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Original Poster
Rep: Reputation: 0
A have a lot of place for decompress images on /mnt/usb. The problem should be in dd-ing worked system drive. I have to made a snapshot if i want to backup without freezing my server, but i did not.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to resize vfat disk image made with dd lindylex Linux - Software 4 03-05-2009 10:25 PM
LVM / PVMOVE ? Disk Image Ammad Linux - General 0 03-01-2009 10:28 AM
clonezilla clone disk to image, when restore from image to destination hdd problem. hocheetiong Linux - Newbie 3 05-06-2008 07:59 PM
restore hard disk from several splitted files by Partition Image powah Linux - Software 4 03-11-2008 10:03 PM
RAID1 LVM disk failure - can't restore ngibsonn Linux - Software 2 03-13-2007 07:49 PM


All times are GMT -5. The time now is 07:16 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration