Upgrade Blue-Ring 500GB Dual Disk- The SAFE Way

January 4, 2011
I read many tutorials and conversations on this wiki about Upgrading and Restoring a dual disk blue-ring NAS and wanted to try it myself as I was running out of space and using RAID0. I consider this wiki page a work in progress (please check back often for corrections, updates) and I dedicate it to others like me looking for the simplest answers. If this is helpful (or you need help), please post something in the comments which is linked on this page and RATE the page at the bottom.

Justification:
I found other HOWTO's to be difficult to follow mostly because I didn't have a second machine with a Linux OS and SATA port to connect the HDD's from the NAS. In my case, it seemed like too much work to set up a Virtual MAchine (VM) or a physical machine only for upgrading my NAS. This wiki entry is journal of what I did.

Prerequisities:
MBWE2 "blue ring"2x500GB NAS in linear (RAID0) or RAID1 mode
Two, new, 3.5" SATA HDD's 1TB or 1.5TB in size, labeled with permanent marker as "new A" and "new B"
SATA-to-USB adaptor -OR- external SATA HDD enclosure
Computer with OSX, Linux, or BSD. (via windows is possible, but more difficult, slower)
SSH and ROOT enabled. All operations here assume you are root. BE CAREFUL and check your commands BEFORE you hit enter!
Optware installed: http://mybookworld.wikidot.com/optware
(only if you upgrade using a non-WD HDD) New HDPARM installed using optware:

#/opt/bin/ipkg update 
#/opt/bin/ipkg install hdparm

If you have a NEW NAS with no data stored on it, please SKIP to step #4 below.
If you have a SINGLE DISK blue rings NAS, this is NOT the howto for you, but you can read to understand what needs to be copied to your fresh HDD.

In a nutshell: (Please read this TWICE to make sure you get this before proceeding)
There was existing data in this NAS stored with RAID0. Basically this procedure involves copying all personal data off the NAS to the first new HDD which is connected to your PC and formatted in the native filesystem. Then, using the second new HDD we copy the default NAS system to the HDD so we can boot from it. This allows us to remove the original HDD's. Then, the last part involves copying the data back into the NAS from your PC and finally installing the second new drive - enabling RAID1. On this NAS, the first 3 partitions are used by Linux. Partition 4 is where your data is stored. It is mounted as "/shares/internal/" .


THE HOWTO:

1. Purchase your new drives (1TB or 1.5TB) from any HDD manufacturer. Western Digital is NOT my personal favorite, but if you decide to use a WD disk, others here have reported that the "heat-monitor" script will work by default with no extra work. That is definitely the EASIEST. Go that route if you require the absolute easiest way. Personally, I plan on using Seagate, but unfortunately it means I have a small bit of extra work later on.

2. Connect ONE of the new HDD's to your computer internally or externally and format it with the local file system (in my case HFS on Mac, but it can be NTFS on Windows, - whatever works for your local machine). If you need to connect to a computer without an extra internal or external SATA port (like my Apple iMac) buy an empty external USB disk enclosure OR one of those handy USB to PATA/SATA adaptors (this is what I have). You should be able to find them online or in a computer market for around 20 USD or Euros give or take. It's made by UniTek. Here are some examples of what it looks like:

http://www.aukcjoner.pl/gallery/001811694-.html#I3

3. Let's backup the contents of "partition 4" aka /shares/internal/ . This can be done via SMB (drag and drop) from OSX or Windows. Or my personal favorite, via SSH/RSYNC to an external disk attached to a personal computer on the network. Either way is fine, and both involve copying files from partition 4 on the NAS to your external USB drive.

If you choose to use SSH and RSYNC, here's a sample command you can run this from Mac OSX or Linux natively from the Terminal.
Copy from NAS to local machine:

# rsync -ave ssh root@192.168.2.3:/shares/internal/ /Volumes/external_USB_drive/NAS_backup/ --progress -stats --exclude PICTURES

Explanation of the command:
The command above tells rsync to calculate which files ned to be copied, and to send them over OpenSSH to the target location. In this case the files will be copied from the MBWE2 to an external USB disk connected to my local machine (a Mac). REMEMBER - You will need to change the paths to match YOUR NAS and your local external drive.

As for the command syntax, the progress flag lets you keep tabs on how the copy is running along with stats. the EXCLUDE feature allows you to skip a folder or certain file types entirely. Wildcards are supported. If you need a complete backup I recommend NOT using the EXCLUDE flag. If you get error messages, keep trying until you get the path correct. It has to be perfect or you'll get errors. If you need help, or want to learn more, read further on "RSYNC via SSH".

3b. NOTE: In Windows you can use Putty and connect via ssh to the NAS first, then mount the drive of the windows machine and run it remotely. In other words, you are running RSYNC from the NAS and not your Windows PC. Although, in this case from windows it will probably be slow since the NAS is doing all the work. The key to speeding things up is having a computer with a native terminal like OSX or Linux, Unix, BSD, etc…

4. After all the files have been copied, power off the NAS. Remove the original "B" drive out and put it in a safe plce. THEN, take the SECOND new HDD you bought to upgrade the NAS (obviously it is blank). Insert this blank HDD as thenew "B" drive into the NAS. Keep your old "B" drive as a backup.

5. Power on the NAS and access the default web interface. Go to DRIVE MANAGEMENT -> FORMAT New Internal DRIVE. Click YES to confirm. This will destroy everything on the new blank HDD. That's OK because it is blank anyhow from the store.

6. Once the format is complete, go back to the web interface and choose to change drive type and select "RAID1". Click OK. This will automatically copy all the partitions 1, 2, 3, and 4 for us and ENABLE RAID1. However, this takes about 3 hours. Do not power off the unit or copy files to the device during this time. NOTE: even having it mounted via SMB/CIFS slows it down!

7. Once the format and mirroring has been restored, the web interface displays "Drive Status: OK" in the upper right corner. After that, power off the unit again. Remove the original drive "A" and store in a safe place with the original drive "B". We're done with the original HDD's now and don't need them. In case anything goes wrong with your new HDD's you now have a perfect backup. You can always put the original drives back in the NAS and everything will be ok.

8. With the NAS still powered off, it's time to move that new HDD you have in slot "B" of the NAS into the slot where drive "A" was previously. In other words, move it up into the other empty position. This makes it the new HDD, along in position "A".

9. Power up the unit with only the "new" drive in the "A" slot. This means you are booting only with one drive - one of your new, blank HDD's. IF you use a non-Western Digital HDD, be sure to immediately kill the heat-monitor process. Failure to do so will result in the unit going into "thermal protect" mode which will halt the device. To do this, SSH in as root and type this command to stop the heat monitor:

# /etc/init.d/S15wdc-heat-monitor stop

At the end of this document we will install a new heat-monitor script. Those that use a Western Digital disk, will be able to ignore it.

10. At this point the unit boots on the new HDD, but there is a partition 4 that is too small. We need to delete partition 4 where the data is and re-create it. First, let's find out where partition 3 ends so we know where to start partition 4. As root type:
fdisk /dev/sda

then type:
p <enter>

You will see something similar to this:

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1               4         369     2939895   fd  Linux raid autodetect
/dev/sda2             370         382      104422+  fd  Linux raid autodetect
/dev/sda3             383         505      987997+  fd  Linux raid autodetect

NOTE the ending block of SDA3 (partition 3). It is 505 - that means the next partition needs to begin with 506. Important for the next step.

11. Now, if there is a partition 4 (sda4) in your list that's ok. We will now delete it. You did check your backup on the other disk on your PC, right?

type this:
d

It asks which partition, select 4 and hit enter

12. Now, we need to create partition 4 back again. To do that type:

n

(for new partition

p

(P for primary)

4
(for the fourth partition)

It then asks for first cylinder. This is where we MUST be careful to type the number from step 10 above. In my case it was 506 and hit enter.

Next it asks for the size. Since we want to use the rest of the disk, we simply hit enter without typing in anything. The default is the rest of the disk.

13. Let's check the partition we made. type p and hit enter. You should see the following:

Device Boot    Start       End    Blocks   Id  System
/dev/sda1               4         369     2939895   fd  Linux raid autodetect
/dev/sda2             370         382      104422+  fd  Linux raid autodetect
/dev/sda3             383         505      987997+  fd  Linux raid autodetect
/dev/sda4             506      121601   972703620   83  Linux

One problem, we need to change the type of partition 4 to be like the others. Note the code "fd" - that's the partition hex code. We need that on the next step.

14. Now, type:
t <enter>
4
(for partition 4 )
It asks for the type of partition. We need to use this:
fd <enter>
The partition is now set as "Linux Raid Autodetect". Now, let's check to see if everything we did so far is ok…

15. Type p and hit enter. This will "print" the partition list so you can check it. It should now show 4 partitions using all the disk with the correct partition type, like this (if it does not go back and check that you did every step from above):

Device Boot    Start       End    Blocks   Id  System
/dev/sda1               4         369     2939895   fd  Linux raid autodetect
/dev/sda2             370         382      104422+  fd  Linux raid autodetect
/dev/sda3             383         505      987997+  fd  Linux raid autodetect
/dev/sda4             506      121601   972703620   fd  Linux raid autodetect

16. Now if everything is in order, we need to SAVE the changes we made. Up to this point we can QUIT without saving. So, if you mess up you can type q here and enter and everything is NOT saved. In our example here, everything looks OK and we want to write the changes to disk, so we type w and hit enter to "write" the changes. After a few seconds the partition is written to the disk.

17. After writing the changes, we need to reboot so that Linux can read the new partition. Reboot the NAS by typing reboot <enter> When the unit restarts don't forget to kill the heat-monitor process like this:

# /etc/init.d/S15wdc-heat-monitor stop

18. After rebooting we need to enable the RAID1 abilities. Type:

mdadm —stop /dev/md4 (to stop the array)
mdadm -Cv /dev/md4 -l1 -n2 -c64 /dev/sda4 missing
(then enter)

Here's what you'll see on screen:

mdadm: chunk size ignored for this level
mdadm: /dev/sda4 appears to contain an ext2fs file system
    size=1461079620K  mtime=Mon Feb 22 18:50:52 2010
mdadm: size set to 1461079552K

You will be prompted to continue creating the array. Press "Y"

Then you will se this:
"mdadm: array /dev/md4 started."

19. Now, let's format the partition. I timed this and it takes about 15 minutes, so go have a tea break after you enter this command:

# mke2fs -L "Data" -j /dev/md4

Then you'll see this displayed (leave for a tea at this point if you didn't already):

mke2fs 1.38 (30-Jun-2005)
Filesystem label=Data
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
182648832 inodes, 365269888 blocks
18263494 blocks (5.00%) reserved for the super user
First data block=0
11148 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Writing inode tables: 10016/11148

Finally, after 15 minutes you'll see this:

Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

20. Let's check to make sure id /dev/MD4 is listed. If it is then everything worked. Issue this command:

# df -m

The output should be something like this:

Filesystem           1M-blocks      Used Available Use% Mounted on
rootfs                    2826      1017      1666  38% /
/dev/root                 2826      1017      1666  38% /
/dev/md3                   950       151       751  17% /var
/dev/md4                935000    195559    691946  23% /shares/internal

21. Now, one last thing. :-) If you installed a Western Digital drive, then skip to the last step. If your HDD is a non-Western Digital like mine is, then it is time to fix the heat-monitor scripts so we don't need to kill the "heat-monitor process after every reboot.

Type all of these individually from the command line as root:

# wget http://kyyhkynen.net/stuff/mybook/temperature_monitor
# mv temperature_monitor /usr/sbin
# chmod 0700 /usr/sbin/temperature_monitor
# chown root:root /usr/sbin/temperature_monitor
# wget http://kyyhkynen.net/stuff/mybook/S51temperature_monitor
# mv S51temperature_monitor /etc/init.d
# chmod 0700 /etc/init.d/S51temperature_monitor
# chown root:root /etc/init.d/S51temperature_monitor
# ln -s /etc/init.d/S51temperature_monitor /etc/init.d/K51temperature_monitor

22. Now, we configure the temperature monitor:

#vi /usr/sbin/temperature_monitor

comment out this line with a # in front of it:

#HDPARM=/sbin/hdparm

and add this line

HDPARM=/opt/sbin/hdparm-hdparm

No further config is needed. But if you want to tweak the temperature or know more about how this works, refer to the links at the end of this document.

23. Reboot and then Copy all the data back to the NAS.

24. After copying is complete and verified, power the NAS off and remove all cables.

25. Put the second "new" drive into the NAS and connect cables, power it up. Access the default web interface "Shared Storage manager".

26. The unit's web interface will indicate "NEW Drive B" in the upper right corner. We will now prepare the drive for use.

27. Click the "Drive Management" tab, You will see displayed "Replacement drive detected on Port B". Then, choose the option to "Format new Internal Drive".

28. The NAS shows that RAID1 will be rebuilt automatically. Confirm this and click "YES, I'm Sure"

29. Wait for the new HDD to be formatted. This should take a couple of minutes . -BUT-

30. After the format completes, the NAS automatically starts rebuilding the RAID1 - this part takes SEVERAL HOURS (for me about 6!). You can check the status in the upper right corner of the web interface. At first it says "New Drive B". Once it starts rebuilding the RAID1 it displays "Synchronizing". When finished it should say "Drive Status: OK"
***CAUTION: During this time you CAN use the NAS, but I recommend that you don't. In fact, I went ahead and killed the torrent daemon just as a precaution because I didn't want the mirror procedure to run out of RAM or CPU.

31. Once the RAID has been rebuilt power off your NAS and put the case back together completely and power it back on. Enjoy your newly upgraded NAS - done the EASY Way.

Arguments:

Why is this "SAFER" or "EASIER"???
Because in this method you don't need to copy or calculate the partition sizes. The NAS takes care of this for you except the last partition, "MD4" where the personal data is.

For this procedure, you don't need to get another computer and install a distro of Linux.

You don't risk screwing up your original HDD's! If this all goes bad, just put your originals HDD's back in your NAS.

No problems with having the "right versions" of tools. Everything is done from an ordinary Mac or Windows PC. The rest is done using the default commands inside the NAS (firmware 2.00.18)

Faster because there is no hassle of getting the partitions wrong, or worse - overwriting the wrong partitions on the wrong disk. I've read of others making this mistake, especially when ROOT is required for all this, so MANY mistakes can be made if you are new to Linux.

Update: March 22, 2010
This wiki entry was recently called "Upgrade Blue-Ring 500GB - The EASY Way", but after some discussion via the "discuss" page, it was decided that it was more aptly called the "safe" way as there are easier/faster ways of upgrading the NAS.

Acknowledgements:
Thank you to the knowledgeable people on this wiki and to the authors of the following wiki entries whose methods and commands I've copied and put into my own way of upgrading the blue-ring NAS. Without them NONE of my work would be possible. Thanks!!

http://mybookworld.wikidot.com/upgrade-500gb-blue-ring-to-1-5tb-wd15ears

http://mybookworld.wikidot.com/add-new-hdd-to-wdwe

http://kyyhkynen.net/stuff/mybook/temperature_monitor.php

http://kyyhkynen.net/stuff/mybook/spindown.php

http://mybookworld.wikidot.com/optware

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License