Re: Unformatting a GFS cluster disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-03-25 at 18:47 +0000, DRand@xxxxxxxxxxx wrote:
> 
> Help! 
> 
> We have accidentally formatted a GFS cluster with this command. 
> 
> mkfs.gfs -J 1024 -j 4 -p lock_gulm -t aicluster:cmsgfs /dev/sda 
> 
> We were using the disk as a backup system. We need to unformat it..
> Are there any tools that will let us get at the disk directory? 
> 
> Damon. 

Hi Damon,

The short answer is no.
There are no tools I'm aware of to "unformat" a gfs file system.
However:

Your ability to get back data depends on how the file system
looked before the mkfs.  If /dev/sda was ext3 before, I don't know
what you can do to recover it.  I do know that gfs and ext3 have
their superblocks in different places, and I don't know ext3.
The same pretty much goes for every other file system (xfs, vfat, etc.).

If, however, /dev/sda was a gfs file system before the mkfs, then
you stand a better chance of retrieving some data.  If /dev/sda
was NOT formatted with the exact same options to mkfs.gfs as before,
(i.e. same rg size, same journal size, same number of journals) then
your chances are very slim.

If it were my file system, and I didn't have a backup, and I had
data on it that I absolutely needed to get back, I personally would
use the gfs2_edit tool (assuming RHEL5, Centos5 or similar) which can
mostly operate on gfs1 file systems.  The "gfs_edit" tool will also
work, but it is much more primitive than gfs2_edit (but at least it
exists on RHEL4, Centos4 and similar).

Bear in mind that this is completely theoretical, dangerous, untested
and likely to NOT work properly, but there is a slim chance it might.

Before I started to mess around with this, I would make a block-by-block
backup of the entire device so I can always go back to where I started.
Something like:  dd if=/dev/sda of=/home/bob/sda.backup bs=1M
(Assuming you have enough space available in /home/bob/)

Assuming that the file system is not mounted from any node in your
cluster, I would use gfs2_edit to go through every entry in the rindex
file, use "j" to jump to each of the resource groups and "F" to go
forward to each of their bitmaps, and for each of those blocks, I would
change every byte in the block map to 0xff.  This would basically tell
gfs that every single block is "in use" and is "metadata".  Then I would
run gfs_fsck with "-y" to see if it could sort it all out.  It may run
for a very long time, and you'll get thousands of messages saying that
everything is in the wrong state.  Anything it finds would probably get
put into the "lost+found" directory, since the mkfs would have erased
your root directory.

I would probably leave the last resource group bitmap all 0x00, though,
otherwise gfs_fsck won't have any place to allocate a new lost+found
directory, etc.

And if I got anything valuable back from it, I'd thank the deity of my
choice.  :7)

Regards,

Bob Peterson
Red Hat GFS


--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux