LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Trying to recover an XFS drive. (https://www.linuxquestions.org/questions/linux-hardware-18/trying-to-recover-an-xfs-drive-4175516192/)

Zippy1970 08-24-2014 06:00 AM

Trying to recover an XFS drive.
 
A friend gave me his Buffalo LS-XHL NAS to look at because it crashed an he has tons of photos on it he wants to recover. Inside the NAS is a 1TB HDD. Apparently, the LS-XHL uses the XFS file system. It uses 6 partitions, of which partition #6 is the data partition.

When I connect the drive to my Windows system, Windows finds all 6 partitions but can only read the first since that's the only FAT32 partition on the disk. The other 5 partitions are XFS partitions. Windows sees those partitions just fine but tells me they need to be formatted first before it can use them (since Windows doesn't support XFS obviously).

When I connect the drive to a linux system, Linux isn't even able to see any partition. DMESG is filled with lines like these:

Code:

[] sd 10:0:0:0:0: [sdb]
[] Results: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[] sd 10:0:0:0:0: [sdb]
[] Sense key: Medium Error [Current]
[] sd 10:0:0:0:0: [sdb]
[] Add. Sense: Unrecovered read error
[] sd 10:0:0:0:0: [sdb] CDB:
[] Read(10): 28 00 00 d5 c0 78 00 00 08 00
[] sd 10:0:0:0:0: [sdb] Unhandled sense code
etc.

parted -l gives me this:

Code:

Error: /dev/sdb: unrecognised disk label
Model: Jmicron Corp. (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk flags:

Doing a xfs_repair /dev/sdb gives me this:

Code:

Phase 1 - find and verify superblock...
superblock read failed, offset 0, size 524288, ag 0, rval -1

fatal error -- Input/output error

What I don't understand is why Windows is able to find all partitions just fine and Linux isn't.

Any tips?

Thanks in advance.

jpollard 08-24-2014 08:06 AM

Windows doesn't attempt to access the partitions...

Linux reads the partition table, and the home blocks of any filesystems in those partitions.

And running xfs_repair on the entire disk is an error. Being a filesystem repair, it only handles the contents of a partition.

It is also possible the disk is using GPT where Linux is not - thus the partitions would not be recognized.

In any case, it appears that the disk has failed...

Zippy1970 08-24-2014 12:51 PM

Quote:

Originally Posted by jpollard (Post 5226360)
And running xfs_repair on the entire disk is an error. Being a filesystem repair, it only handles the contents of a partition.

Ok, but linux doesn't see any partition, even the one that Windows is able to read just fine (the first - FAT32 - partition).

metaschima 08-24-2014 01:32 PM

I am concerned that the drive my be failing, so it would be wise to use ddrescue to image the data partition to another drive. Then you can either try to recover that partition or carve data out of it using testdisk or foremost.

After you image the partition you may want to check the SMART attributes using 'smartctl -a /dev/sd?' where ? is the correct device.

Zippy1970 08-24-2014 03:26 PM

2 Attachment(s)
Again, the thing is that I don't understand why Windows sees all partitions just fine, and Linux sees none. No matter what distro I try.

This is what linux sees (click to enlarge):

Attachment 16213

And this is what Windows sees (click to enlarge):

Attachment 16214

PS: I thought the first partition was FAT32, but it's actually EXT3 (and I have an Ext3 driver installed on Windows).

syg00 08-24-2014 06:52 PM

It may be that Windows isn't as strict in its checking. Wouldn't be the first time.
Maybe try sfdisk - it's likely to be less strict than (recent) libparted. Or see if testdisk will take a look at it.

Zippy1970 08-24-2014 07:22 PM

Quote:

Originally Posted by syg00 (Post 5226544)
Or see if testdisk will take a look at it.

I thought testdisk didn't support XFS?

metaschima 08-24-2014 08:04 PM

Check the main page:
http://www.cgsecurity.org/wiki/TestDisk
It can find XFS partitions. Photorec can also carve data like foremost (filesystem doesn't matter for this).

jefro 08-25-2014 02:51 PM

At one time an app called Ranish used to be able to correct partitions. Not sure if that has been updated.

EDDY1 08-25-2014 03:24 PM

This link tells what tools you need for reading & manipulating xfs
https://wiki.ubuntu.com/XFS

TobiSGD 08-25-2014 04:13 PM

Proper mode of operation for recovering data from failing disks:
1. Create an image of the disk or partition in question. Once you have created that image disconnect the disk (data and power) and leave it alone.
2. Make a copy of the image file and from now on only work on that copy, leave the original alone, so that failed recovery attempts can be compensated with just creating a new copy from the original.
3. Try to mount the filesystem(s) (using the offset option of the mount command), if that doesn't work use the filesystem tools to try to repair the filesystem. If that also doesn't work use a file carver like Photorec to try to recover the files.


All times are GMT -5. The time now is 06:29 PM.