Wednesday, January 4, 2017

Copying Files off a Harddrive from a Western Digital NAS


Buddy (names withheld to protect the stupid) came to me with a drive  saying he couldn't get his data off it.   Buckle up folks, this story got convoluted fast, and took me forever to get out of him.  I'll skip the step of turning that into a narrative and save you the trouble of having to read that by giving you the Reader's Digest version.

It all started with his son rage quitting on his laptop and destroying the motherboard in the process.  Turns out that the hard drive took a good hit too and was toast. Buddy had to take the drive to a professional data recovery firm to get his data off the drive.

I suspect that they required him to supply a new hard drive to dump the recovered files on to.  This where it gets interesting technically.  He pulled it out of some sort of Western Digital NAS.  It had a bizarre layout for a single drive NAS:


Layout of the drive from the WD NAS

Who puts a RAID array set on the same drive?  Alas, that was not the weirdest thing.  I knew that the data partition must have been /dev/sde4 as it was the largest.  When I tried to mount /dev/sde4, 'mount' errorred out and the following showed up in my syslog:

[ 1080.819587] EXT4-fs (sde4): bad block size 65536

Turns out that sde4 is actually an EXT3 or EXT4 filesystem with a 64k block size instead of the usual 4K block size.  A bit of googling later I learned that the Linux kernel when running on an x86 platform, can not do a 64k block size.

FUSE to the rescue!


Luckily, there is a work around.  Seems that other owners of the WD NAS's pull the drives out of the NAS for what ever reason and get stuck with this problem.  So with /dev/sde4 being the WD NAS drive and /dev/sdg1 being the new Windows friendly drive here's what was done:

sudo mkdir /mnt/sdg1
sudo mkdir /mnt/sde4
sudo mount /dev/sdg1 /mnt/sdg1
sudo apt install fuseext2
sudo fuseext2 -o ro -o sync_read /dev/sde4 /mnt/sde4
sudo rsync -ahv  --no-perms --no-owner --no-group /mnt/sde4/shares /mnt/sdg1/
I'm going to leave out the commands I used to prepare /dev/sdg which was a new 'WD My Passport'.  I figured it was best to reformat the drive  both so it would be easier to move files on to a VFAT filesystem rather then an NTFS filesystem and there is the odd story about viruses and other junk that is preinstalled on some consumer drives.

Unmounting the drives


Before ripping the Passport drive from the USB port, it's very important to unmount the filesystem. Simply run this:

sync
umount /dev/sdg1
umount /dev/sde4

Problems I encountered


The rsync command did take a while and I did run into some problems with the process just stalling a few times.  'iotop' would show no disk IO and there was no indication anywhere about something had gone wrong.  I'm not sure why that happened but once I added the '--no-' options to the rsync it worked fine.  Perhaps it was luck, perhaps there was something fundamental about that.

Conclusion


While is was a tiny bit of challenge,  it was pretty straight forward to pull the data off the WD NAS drive.   If you find yourself in a similar situation, I hope this helps out.

No comments: