Installing firmware on a new disk (Home Media)
Posted on 09/08/2016
Connecting the disk
Connect the new disk to a Linux PC. (A windows PC booted from a Linux Live CD or -usb stick is fine). You can use an USB-SATA converter, or connect the disk on an in- or extern SATA port.
Note: the instructions below apply to Home Media Network Hard Drive (aka classic) only. Do not try with Home Media Cloud Edition (model: HMND2) which won’t work. For Home Media Cloud Edition box try with image restore discussed in forum thread – http://forum.nas-central.org/viewtopic.php?f=269&t=4703. I’ve restored my 1TB HMND2 successfully with the method. For 0 disk free space issue after image restore just execute the factory restore option once the box is online with GUI accessible. Browse the first 2 pages of the thread you should get the idea where to download and what command to restore the image.
Find device name
Find the device name of the disk:
cat /proc/partitions
You can recognize the disk by it’s size. (The size is given in ‘blocks’, which is 1 KiB)
I’ll assume the disk is sdb for the rest of the story.
Collect files
Download mbr+uboot+kernel.gz and sda1-2064.tgz here.
Become root
You’ll need to have root rights to do the next steps. In Ubuntu or Knoppix you can get these by executing
sudo su
In most other flavors you just execute
su
MBR, uBoot and kernel
Write mbr+uboot+kernel.gz to disk:
gzip -dc /full/path/to/mbr+uboot+kernel.gz | dd of=/dev/sdb
(when using sudo for root things, this should be
gzip -dc /full/path/to/mbr+uboot+kernel.gz | sudo dd of=/dev/sdb
)
Change data partition size
Use fdisk to remove partition 2, and add it again. Primary partition. (your disk will have a different size than the mbr donor).
fdisk is started by:
fdisk /dev/sdb
and use ‘m’ to get further help.
Change the partitiontype of partition 2 to fd.
Write partitiontable and exit fdisk.
For the lazy people, the exact keystrokes in fdisk are:
d<enter>2<enter> | (delete partition 2) |
n<enter>p<enter>2<enter> | (create new, primary, partition at slot 2) |
<enter><enter> | (default start- end endsector) |
t<enter>2<enter>fd<enter> | (change type of partition 2 to ‘fd’) |
w<enter> | (write changes and exit) |
System partition
Format partition 1:
mke2fs -j /dev/sdb1
Create a mountpoint, and mount partition 1:
mkdir /tmp/sdb1 mount /dev/sdb1 /tmp/sdb1
Install the rootfs:
cd /tmp/sdb1 tar -xzf /full/path/to/sda1-2064.tgz
The last command might give a lot of errors about unresolved symlinks in /etc/ssl/. This is normal. The symlinks point to files which really don’t exist
Data partition
Format partition 2:
mkfs -t xfs /dev/sdb2
It is possible that you have to install xfsprogs first. On Ubuntu or Debian:
apt-get install xfsprogs
Some people have reported problems with formatting partition2 using mkfs. This should work, and very quickly:
mkfs.xfs -b <allocation block size> /dev/sdb2
where block size = 512 to 4096. With lots of small files, using smaller allocation-block size will waste less space at the expense of performance. Although we’re really limited by the slow SATA controller and NIC in this box anyway.
Ready
When you put this disk in your Home Media, it should work.
On a Home Media the MAC address is stored on the disk. For this disk image it’s 00:d0:b8:09:68:1e. If you want to change it, you’ll have to edit /etc/modules.