Installing firmware on a fresh disk (D2 Network 2)

Preparation
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. You'll need mdadm and xfstools. mdadm is not installed by default on an Ubuntu system, so you'll have to install it: sudo apt-get update sudo apt-get install mdadm

Collect files
Download the files here.

Find device name
Find the device name of the disk: cat /proc/partitions

The unit in the table is kB. I'll assume the disk is sdb for the rest of the story.

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

Create partitions
Use fdisk to generate this partition table: 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/sdb1              1         250     2008093+  5 Extended /dev/sdb2            251      121601   974751907+ fd Linux raid autodetect /dev/sdb5              1          32      256977  fd Linux raid autodetect /dev/sdb6             33          33        8001  83 Linux /dev/sdb7             34          35       16002  fd Linux raid autodetect /dev/sdb8             36         141      851413+ fd Linux raid autodetect /dev/sdb9            142         249      867510  fd Linux raid autodetect /dev/sdb10           250         250        8001  83 Linux /dev/sdb2 is the data partition, it uses all remaining space. /dev/sdb2 is a primary partition, /dev/sdb1 is an extended partition, and all other partitions are logical.

fdisk is started by: fdisk /dev/sdb and use 'm' to get further help. If your fdisk shows a different unit size, try fdisk -c=dos -u=cylinders /dev/sdb then use: p for listing partitions n for creating new partitions w for exit fdisk and writing the new configuration on disk

After starting fdisk a 'p' command should show that:

Command (m for help): p Disk /dev/sdb: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000f26c1 Device Boot     Start         End      Blocks   Id  System /dev/sdb1              1         250     2008093+   5  Extended /dev/sdb5              1          32      256977   fd  Linux raid autodetect

Now create new partitions:

Command (m for help): n Partition type: p  primary (0 primary, 1 extended, 3 free) l  logical (numbered from 5) Select (default p): l Adding logical partition 6 First cylinder (33-250, default 33): 33 Last cylinder, +cylinders or +size{K,M,G} (33-250, default 250): 33

Command (m for help): n Partition type: p  primary (0 primary, 1 extended, 3 free) l  logical (numbered from 5) Select (default p): l Adding logical partition 7 First cylinder (34-250, default 34): 34 Last cylinder, +cylinders or +size{K,M,G} (34-250, default 250): 34

Command (m for help): n Partition type: p  primary (0 primary, 1 extended, 3 free) l  logical (numbered from 5) Select (default p): l Adding logical partition 8 First cylinder (35-250, default 35): 35 Last cylinder, +cylinders or +size{K,M,G} (35-250, default 250): 140

Command (m for help): n Partition type: p  primary (0 primary, 1 extended, 3 free) l  logical (numbered from 5) Select (default p): l Adding logical partition 9 First cylinder (141-250, default 141): 141 Last cylinder, +cylinders or +size{K,M,G} (141-250, default 250): 249

Command (m for help): n Partition type: p  primary (0 primary, 1 extended, 3 free) l  logical (numbered from 5) Select (default p): l Adding logical partition 10 First cylinder (250-250, default 250): 250

Then create the sdb2 primary partition

Command (m for help): n Partition type: p  primary (0 primary, 1 extended, 3 free) l  logical (numbered from 5) Select (default p): p Partition number (1-4, default 2): 2 First cylinder (251-60801, default 251): 251 Last cylinder, +cylinders or +size{K,M,G} (251-60801, default 60801): 60801

Then confirm changes with 'w'

Command (m for help): w The partition table has been altered!

now a fdisk -l command should show:

Disk /dev/sdb: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000f26c1 Device Boot     Start         End      Blocks   Id  System /dev/sdb1              1         250     2008093+   5  Extended /dev/sdb2            251       60801   479941875   83  Linux /dev/sdb5              1          32      256977   fd  Linux raid autodetect /dev/sdb6             33          33        8001   83  Linux /dev/sdb7             34          34        8001   83  Linux /dev/sdb8             35         140      851413+  83  Linux /dev/sdb9            141         249      875511   83  Linux /dev/sdb10           250         250        8001   83  Linux
 * 1) fdisk -c=dos -u=cylinders -l /dev/sdb

/dev/sdb5 (swap)
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb5 missing --metadata=0.90 mkswap -f /dev/md0 mdadm --stop /dev/md0

/dev/sdb7 (initfs)
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb7 missing --metadata=0.90 mke2fs -j /dev/md0 mkdir /tmp/md0 mount /dev/md0 /tmp/md0 cd /tmp/md0 tar xzf /full/path/to/sda7.tgz cd .. umount /tmp/md0 mdadm --stop /dev/md0

/dev/sdb8 (ro layer rootfs)
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb8 missing --metadata=0.90 mke2fs -j /dev/md0 mount /dev/md0 /tmp/md0 cd /tmp/md0 tar xzf /full/path/to/sda8.tgz cd .. umount /tmp/md0 mdadm --stop /dev/md0

/dev/sdb9 (rw layer rootfs)
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb9 missing --metadata=0.90 mke2fs -j /dev/md0 mdadm --stop /dev/md0

/dev/sdb2 (data partition)
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb2 missing --metadata=0.90 mkfs.xfs /dev/md0 mdadm --stop /dev/md0

/dev/sdb6 (kernel)
gzip -cd /full/path/to/sda6.gz | dd of=/dev/sdb6

/dev/sdb10 (update kernel)
dd if=/dev/zero of=/dev/sdb10

Finish
Put the disk in the NAS, and do a factory reset. After it has rebooted, use the webinterface to format the data partition.