Knowledge sharing: Replacing drives in USB and NAS external units

Reece Arnott <[email protected]> Tue, 06 Jan 2015 17:00:49 +1300
Newsgroups gmane.org.user-groups.linux.dunedin.general
Message-ID <[email protected]>
(CC'd to DunLug list due to the question at the end)

I moved flats and in the process my 3TB (Western Digital MyBookLive) NAS 
dropped on the floor and the drive stopped working. It was a backup for 
my 3TB (Western Digital Elements) USB 2 drive so I bought a 4TB USB 3 
Seagate external drive, copied all the data to it and then opened up the 
3TB USB 2 device, took out the drive, and put it in the NAS enclosure.

The first disassembly video I came across for the NAS was: 
https://www.youtube.com/watch?v=TGLJi66vxnY
I had already disassembled it myself by that point and broke off a 
couple of catches and what the video calls "the attached rubber" (at 
6:05) so that it would be easier to replace the drive again if need be.

To open up the USB 2 drive enclosure there is a disassembly video at 
https://www.youtube.com/watch?v=y5t6FUvNIVM but it is much easier so 
long as you know where the internal catches are.

The harder part is formatting the NAS device properly. For this I 
followed the instructions (mostly) at 
http://community.wd.com/t5/My-Book-Live/GUIDE-How-to-unbrick-a-totally-dead-MBL/td-p/435724 
to download the firmware image, wipe the drive, and partition it 
correctly and install the firmware on to it (using the debrick script 
linked on the page with the destroy parameter).
i.e. sudo ./debrick.sh rootfs.img /dev/sdb destroy (after extracting the 
rootfs.img file from the latest firmware deb file)

Instead of using the system rescue cd I used my Ubuntu 14.10 Linux 
laptop. I needed to install mdadm which is used by the debrick script to 
create a 2GB raid partition for the firmware/OS for the NAS device.

For some reason, the command in the script to create the main data 
partition didn't work (quoting from the script):
  #blocksize 65536 is required by the hardware, you won't be able to 
mount if different.
     mkfs.ext4 -b 65536 -m 0 $diskData

After running the script I ended up with a NAS device with a 2x2GB RAID 
partition with the OS, a partition that needed to be formatted and used 
for swap, and another partition that needed to be formatted as ext4 with 
a non-standard block size for the data itself.

So, to finish it off I ssh'd into the device as root and ran the following:
mkswap /dev/sda3
mkfs.ext4 -b 65536 -m 0 /dev/sda4
reboot
---ssh in again after reboot---
swapon -s
parted
p (from within parted to print out a partition list to make sure its 
correct)

Then I could connect over the network as per normal via the public smb 
share and copy files around.
Note that it was annoying that I had 2.2TB of stuff on the 3TB drive 
that started life as an NTFS formatted partition, and ended with the 
same 2.2TB on a 3TB (minus 4GB) non-standard ext4 partition on the same 
physical drive in the NAS enclosure. I ended up copying the data to a 
4TB drive, wiping the 3TB, and copying the data back again.

There may have been a way to resize and convert the partition but that 
would have meant either playing with the only existing copy of my data 
or copying it to the 4TB drive first as a backup anyway. A quick search 
doesn't show any 'convert in place' and I suspect the easiest way (which 
would only work if I had <50% full drive) would be to resize the NTFS 
partition to 50% of the drive, create the ext4 partition filling the 
other 50%, and simply copy/move the files from one partition to the 
other before deleting the NTFS partition, resizing the ext4 partition 
and creating the swap and OS partitions.

Anyone got any magic command to do an in-place NTFS->ext3 partition 
conversion (in particular one that would work with this non-standard 
block size)?


-- 
"Believing men would act in their own interest was not cynicism, it turned out, but sheerest optimism; in reality men do not meet so high a standard."
-- Harry Potter and the Methods of Rationality (Chapter 84)
http://hpmor.com/

Reece Arnott
Dunedin
New Zealand


_______________________________________________
DunLUG mailing list
[email protected]
http://lists.ethernal.org/listinfo/dunlug
DunLUG Wiki - http://dunlug.kallisti.net.nz/