Recovering data after UFS drive crash

Status
Not open for further replies.

vadefimov

Cadet
Joined
Apr 16, 2012
Messages
2
Hello!
I make small file server with FreeNAS-8.0.4-RELEASE-p2-x86 (11367) with two HDD, 500Gb each.
Volumes were created via GUI using UFS ( on this machine ZFS will work too slow). After some time one of drives reported SMART error
"Offline uncorrectable sectors" for drive used for backups. Fortunately, now is just trial run and data loss is not a problem,
but for future it will be very important to know, what files are broken.
I found some advices ( http://smartmontools.sourceforge.net/badblockhowto.html , http://www.opennet.ru/tips/info/1720.shtml ) and tried to follow them, but without success.
As I understand FreeNAS use some special format for UFS, because HDD works for read/write, but I cant use BSD commands for it, as well as for second (healthy) HDD:

[root@fs] ~# bsdlabel /dev/ada0
bsdlabel: /dev/ada0: no valid label found

[root@fs] ~# debugfs
debugfs 1.41.14 (22-Dec-2010)
debugfs: open /dev/ada0
/dev/ada0: Bad magic number in super-block while opening filesystem

[root@fs] ~# fsdb /dev/ada0
** /dev/ada0
Cannot find file system superblock
ioctl (GCINFO): Inappropriate ioctl for device
fsdb: /dev/ada0: can't read disk label

So, question is what shall be done in case of partially corrupted data ?
Is there some special command to detect corrupted files or maybe I shall make somehow corrections to filesystem and it will be accessible to BSD commands?
Also, I didn't try it - will be UFS volume created by FreeNAS readable via win UFS viewer ?
 

vadefimov

Cadet
Joined
Apr 16, 2012
Messages
2
Device is recognized properly, gpart works OK, fsck reports only problem while reading bad sector. It's OK, we know about it from SMART and have another drive.
We can slow, but definitely determine all problem blocks with dd.
But how can I know - what file(s) are broken??
Proposed way was:
- find out File system block size in bytes ( shall be 4096, but would be better to get it from system);
- determine which File System Block contains this LBA;
- locate the inode stored in this block, and the file that contains that inode.
Is it possible with UFS?
As I don't have real data on HDD, I exported it and again created UFS volume with same drive.
Now smartctl and dd still reporting about problem , but for fsck everything is OK.

[root@fs] ~# fsck /dev/ufs/Copy
** /dev/ufs/Copy (NO WRITE)
** Last Mounted on /mnt/Copy
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 2 used, 119661716 free (20 frags, 14957712 blocks, 0.0% fragmentation)
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
Yes, you can figure out which file that uses a certain diskblock, you will have to read the inode table
and follow all block pointers ( direct indirect triple indirect etc)

But , if you have one bad block that the disc won't remap your disc is dangerously broken and should be
scrapped. Restore data from backup ( as you don't know if undetected corrupted data is present).

This is exactly the scenario that zfs protects from.
 
Status
Not open for further replies.
Top