Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I lost all of my data (8 TB) which I collected over the past few years yesterday because I made some seriuos mistakes during the remounting of my LVM. I run a XenServer5.6 installation with additional 4 harddisks for data storage. An LVM over those 4 HDDs was used to store all of my data. Yesterday, I reinstalled XenServer and wanted to mount my old Harddrives and add the LVM. I run

xe sr-create [...]

for all disks (/dev/sdb .. /dev/sde), but that was totally wrong. This command deletes the old LVM on the disks and created an new, empty lvm on every single disk with no partitions. No i got 4 empty harddrives :(

Is it possible to recover some data from that lost LVM volumes? I have no clue how to do it because i deleted all informations about the old LVM. Is there a way to access the files insed that old lvm directly?

share|improve this question

1 Answer 1

Try vgcfgrestore. LVM normally saves backup of all LVM metadata in /etc/lvm/backup and older backups go in /etc/lvm/archive.

To check what backups you have:

vgcfgrestore -l <volumegroupname>

A dry run of a backup restore:

vgcfgrestore -t <volumegroupname>

And actually restore the most recent backup:

vgcfgrestore <volumegroupname>

To restore a different backup (check the output of the -l switch):

vgcfgrestore -f /etc/lvm/archive.... <volumegroupname>
share|improve this answer
    
Thanks for your answer! When are those backups created? The only command I executed was the "xe sr-create.." command, does this create such an backup? –  Matthias Bayer Dec 7 '12 at 12:16
    
A backup is created every time you run a command to modify the LVM. So a backup would have been created every time you modify your lvm configuration with lvcreate, lvremove, etc. Or even vgs. –  chutz Dec 7 '12 at 16:39
    
Oh no, there was no backup :( Just one for the XenServer installation lvm... damn! I'll try to read raw data somehow next... –  Matthias Bayer Dec 7 '12 at 20:31
    
You can search for file system superblocks using certain tools. For example, when recovering from a lost disklabel in a BSD system, you can run scan_ffs(8) to discover data about file systems on a given disk. There should be similar tools for Linux and instructions for recovering the data. –  Bort Dec 12 '12 at 21:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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