upgrading my dns-323 to 2 X 2 TB II - format

After a few attempts which ended in failure, I managed to format my 2 x 2TB 4k Western Digital drives. Now that it’s done, it seems incredibly simple. It is also “sticky”, meaning it does not need to be performed on each reboot (DUH!). 

As explained in the first part, it makes far more sense to use 2 separate drives as opposed to JBOD, RAID 0 or RAID 1. However, if you are keen on using RAID, I included a guide at the end, courtesy of dmcwai.

In summary, I will be formatting the drives with the DNS-323 utility, install funplug, root it, install the functional fdisk, telnet into the box,

I followed this step-by-step procedure:

dlink dns-323 formatting drives1. Label the drives, then install them; access the web interface and format. I had already upgraded to the latest firmware (1.08), but if you have not, consider doing so after format is complete.

dns323-format2. Download and install funplug. Go to the URL in the image (also linked below, in sources), then download the latest fun-plug (i.e., the fun_plug and fun_plug.tgz files) and save them into the root of Volume_1 via the network share. Reboot your unit and if the install is successful, the .tgz file will have been exploded into the /ffp directory.

fun-plug download 3. After making sure that the /ffp directory exists and the .tgz file has been deleted (signifying a successful install of funplug), telnet into the box. I prefer Putty; if you don’t, just press Windows Key + R and then type “telnet 192.168.x.y” then enter, replacing x and y with the appropriate numbers you can get from your router; or just use the name of the device instead of 192.. – in my case, dlinky.

After getting a prompt, set the root password then login as root:

/ # passwd
Changing password for root
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
New password:
Bad password: too simple.
Warning: weak password (enter it again to use it anyway).
New password:
Re-enter new password:
Password changed.
/ # login root
No mail.

I used something simple, as it is only temporary.

5. Download & install fdisk. The default fdisk will fail with a “segmentation fault”. Luckily, you can download a working version from the link below. It’s bzipped, so you’ll have to uncompress it to the root of Volume_1. I used 7zip on my desktop, but any archiver will do. Rename the existing fdisk by adding a .old extension, then move the new fdisk in the sbin directory and make it executable:

root@dlinky~# cd /mnt/HD_a2/ffp/sbin
root@dlinky:/mnt/HD_a2/ffp/sbin# mv fdisk fdisk.old
root@dlinky:/mnt/HD_a2/ffp/sbin# ls ../..
fdisk     ffp       ffp.log   fun_plug
root@dlinky:/mnt/HD_a2/ffp/sbin# mv ../../fdisk .
root@dlinky:/mnt/HD_a2/ffp/sbin# chmod +x fdisk

6. Stop mess-around processes. I used /dev/sd?1 in the swapoff command, but I see no reason why it shouldn’t works just for b, as that’s the only one you’ll be using.

root@dlinky:/# smb stop
$Shutting down SMB services:
$Shutting down NMB services:
root@dlinky:/# nfs stop
-sh: nfs: not found
root@dlinky:/# swapoff /dev/sdb1
root@dlinky:/# umount -a
umount: can't umount /dev/pts: Device or resource busy
umount: can't umount /mnt/HD_a2: Device or resource busy
umount: can't umount /sys/crfs: Device or resource busy
umount: can't umount /: Device or resource busy
umount: can't umount /: Device or resource busy

7. You’re finally ready to fdisk it:

root@dlinky:/# fdisk -u /dev/sdb

The number of cylinders for this disk is set to 243201.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63     1060289      530113+  82  Linux swap / Solaris
/dev/sdb2         2088450  3907024064  1952467807+  83  Linux
/dev/sdb4         1060290     2088449      514080   83  Linux

Partition table entries are not in disk order

Command (m for help): d
Partition number (1-4): 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First sector (63-3907029167, default 63): 64
Last sector, +sectors or +size{K,M,G} (64-1060289, default 1060289):
Using default value 1060289

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 2
First sector (63-3907029167, default 63): 3164808
Last sector, +sectors or +size{K,M,G} (3164808-3907029167, default 3907029167):
Using default value 3907029167

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              64     1060289      530113   82  Linux swap / Solaris
/dev/sdb2         3164808  3907029167  1951932180   83  Linux
/dev/sdb4         1060290     2088449      514080   83  Linux

Partition table entries are not in disk order

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

Calling ioctl() to re-read partition table.
Syncing disks.

8. Create the swap and turn it on. In my initial round, I turned all of them on (sd?1) because I had turned all of them off.

root@dlinky:/# mkswap /dev/sdb1
Setting up swapspace version 1, size = 542831616 bytes
root@dlinky:/# swapon /dev/sdb1

9. Format the partition with make2fs. This will take a while.

root@dlinky:/# mke2fs -j -m 0 -T largefile4 /dev/sdb2
mke2fs 1.41.0 (10-Jul-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
476576 inodes, 487983045 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
14893 block groups
32768 blocks per group, 32768 fragments per group
32 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:     0/14893    ..                          
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

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

10. Make it permanent.

root@dlinky:/# hd_verify –w
hd verify v1.23.10072009
Force write verify to hd

11. Shutdown, swap discs among themselves, then reboot and repeat the whole procedure to properly 4k format the other disc as well. Make sure you reboot and test that both drives are formatted with the second partition starting on 64 and that they are writable.

12. I will now commence the copying of the data from my 2 TB array onto one or both drives. To do so, I will place the 2 RAID drives in the DNS-323 and the 2 x 2 TB will be mounted under Linux on my multiboot desktop, using Thermaltake Blacx docking station and / or a 5.25” Trayless SATA Hot Swap Drive Bay.

dns-323 + thermaltake blacx docking station + StarTech 5.25" Trayless SATA Hot Swap Drive Bay

I don’t expect any problems in copying the data, but I will update this document if I encounter any. It turns out that copying the whole thing might take the whole day. I’m thinking to attach the 2TB monster to dlinky via USB and rsync the data using DNS-323.

Sources / More info: funplug-dl, funplug-howto, fdisk-forum, fdisk-download, dcmwai-raid-guide


Pavlo said…
Hey, that is what I was looking for! Many thanks for sharing this info!
Pavlo said…
InBonobo, have you experienced the following issues on HDD installation?

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

I've read that this problem may be caused by "incorrect work of FDISK" and seen recommendation to use PARTED...

I am trying to connect just 1 WD 2TB HDD like yours into NAS-323, but almost gave up after few days of failed attempts...
Pavlo said…

Thnaks for your immediate reply. I've tried mentioned combinations but with no success. Still, thanks for pointing into the right direction!!

I believe the root of problem is in using SINGLE HDD. To be able to "detach" everything from HDD, telnet server should be loaded into memory (ramdrive).

I am now trying to use followign instruction now: http://docs.google.com/document/pub?id=1FIcG6ORtV9yqIK-4MLNgNLlQeHOb3Fxpu_OpLbd4Npg

Due to some reason I am not able to install Telnet into memory disk so will find additional temporary SATA drive.
InBonobo said…
That's a good start - I also posted that guide above, in the window below "Sources".

It seems to me you have 3 choices:
1. Install into memory following that guide
2. Format the drive under linux on your computer (e.g., start linux with a live distro, without installing and work your magic there)
3. Attach a USB key to the NAS and install / run ffp from there. In the next article you will find a guide on how to accomplish that.
4. Use a spare in the NAS.

You're right, my guide works only for 2 disks, as that's what I had. If I were you, I would try to get ffp to boot from a USB key, as that will give you the most benefits - i.e., it is a good idea to be able to attach USB storage to the NAS, isn't it?
Pavlo said…
I just used additional old 80GB drive and was able to repeat your instruction just in few minutes.

And all worked fine!!!

Thanks again for all support! Actually you did a job D-Link/WD should! (UP)

InBonobo said…
I'm glad it helped!

As a customer, I'm angry at D-Link for their lack of support. OTOH, as someone who worked in IT, I know that before you support something potentially problematic, you want to ensure that you can answer any questions. Supporting something inadequately could cause bigger headaches than not supporting it at all.

The problem is that nobody knows (I certainly didn't) at purchase that there is an issue with 4k. In all fairness, this is more of a WD lack of disclosure problem - and adequately mentioning in marketing materials - than it is a D-Link problem. D-Link could have raised to the occasion and quickly supported it, like other manufacturers did (Netgear and Synology, from what I've heard).
Michel R. said…

Thanks for the info... I'm sort of there... I think. What kind of performance (Mb/s) should I be seeing? (ballpark figure..) Just want to make sure I don't have to redo this again once I've copied a few hundred Gb to the drive. :)

A.G.G. said…
Great guide, just one thing. I'm just plannin to buy 2x2T EARS drives into my 2 DNS323s.

I just have one question:
Shoudn't the /dev/sdb2 start address be 2088456 (meaning no loss of 523MB???)

I've checked my current setup and the swap is from 1060290 to 208849 (for stand alone drives), which in the case of RAID or so it seems is from 1060290 to 3164804.

Your guide suggest the re-alignment start address for RAID setup swap sizes, but that actually leave 523Megs un-partitioned (although completely well aligned).

So I think as the end of the Swap partition is 208849 and the first 8 dividable sector number is 2088456 (and not 3164808) meaning all the space could be utilized.

Unfortunately I don't have the drives yet for testing but in my opinion those numbers would mean complete alignment and space utilization.

A.G.G. said…
Sorry, not 208849 but 2088449 :)
A.G.G. said…
Thanks for the answer...just curiosity regarding the jumper settings: http://www.wdc.com/en/products/advancedformat/

So as far as I know jumper 7-8 puts the drive in a "compatibility" mode for single partition...I was wondering if that should be done also at the time of the initial partitioning or not (kernel is 2.4 in the DNS, so pretty close by age to XP), BUT we have 3 partitions so overall no idea.

Referring back to the previous post in my opinion for FW 1.08 b09 and ffp5.0 the partition set-up should be:
Device: Start End Blocks Id System
/dev/sdb1 64 1060289 530113 82 Linux swap
/dev/sdb2 2088456 3907029167 1951932180 83 Linux
/dev/sdb4 1060296 2088449 514080 83 Linux

now that I think about it the proposed start address for the sdb4 is kinda wrong (proposed as 1060290, while and 8 dividable address is 1060296 so that might also cause inconsistency and possibly wrong system ID in other systems outside of the DNS...

So 2 things possibly in my opinion: jumper 7-8 setting and also modified start addresses for sdb2 and sdb4...I hope this will clear it out a bit and might help with slow transfer rates if the drive is in another system...
InBonobo said…
I have not changed the jumper settings at all, precisely because 2 partitions are formatted "new style" while the last one is fomatted "old style". The old partition (sdb4) is formatted by the NAS and I suspect that is where the partitioning information is saved. If you mess with that partition, the NAS will not use the disk unless you reformat. So I would suggest that this is the best way to proceed.

Have you tried using the settings you are proposing?
Amunoz_tico said…
I only want to install ONE HDD model W20EARS.. What do I have to change in the procedure?
InBonobo said…
Amunoz, see my comment below - the one that starts with That's a good start. Pavlo has done just that using a spare hard drive, but you can also use a USB key or format the drive under linux.
Robert said…
Thanks for the guide, but how do I check after that the drive is in 4k format?
Mail said…
Do you think it failed because of the TLER bit disabled in firmware problem?
Jeff said…
According to the WD ADF linux formatting instructions (http://wdc.custhelp.com/cgi-bin/wdc.cfg/php/enduser/std_adp.php?p_faqid=5655), it says to "Make sure that all partitions start on a multiple of 8 sectors (8x 512B = 4KB) and that partition sizes are multiples of 8 sectors." In other words, not only should you adjust the Start sector to be divisible by 8, but the end unit needs to be adjusted as well. For example, if you adjust the start to 64, you should set the end sector to 1060224 so that Start - End / 8 also works to a round number. No?
Jeff said…
Just couldn't get any worthwhile performance improvements with the changes? I haven't tried it yet, but maybe check out this new guide here: http://forums.dlink.com/index.php?topic=14484.0
Guest said…
Thanks for guide!

For grins, I installed the WD20EARS(formated by the DNS-321) into my Windows machine and ran the WD Align Software against it. I had to destroy the existing file systems so WD Align would work - but I got the info I wanted.

The following is what WD software considers "aligned". Yup, WD software started the first partition at sector 2048!

Device Boot Start End Blocks Id System
/dev/sda1 2048 1058815 530116 82 Linux swap / Solaris
/dev/sda2 2088960 3907029167 1952470356 83 Linux
/dev/sda4 1058816 2088959 514080 83 Linux
InBonobo said…
I returned the disks and got better ones. I'm sure "Advanced Format" is the
future, but I'm an old timer, I guess :)
InBonobo said…
Possibly. I gave up on it altogether. If you'd like to write a new guide,
I'll post a link here.
InBonobo said…
If you look at the guide above, when running fdisk and printing the
partition table, there is a difference between the "Start" value in the
first run and the "Start" value in the second. If you run it on yours and
you see the value in the second, you were successful.
InBonobo said…
I did not perform any calculations, nor did I want to. I let His Highness,
the fdisk utility suggest the defaults and I accepted them by hitting Enter
You are most likely right, though, thank you for pointing that out.

As I was stating in the previous comment, I nonetheless noticed a strange
occurrence: when I connect a drive via USB using Thermaltake's BlacX, fdisk
reports the first partition at 66. When installed back in the unit, it's
reported correctly. In any event, the rsync went painfully slow..
InBonobo said…
Sadly, after trying to move the data from my RAID to the newly formatted
drives, I have to report a massive failure. Somehow, the partition boundary
changed to 66 and the write performance, as expected, plummeted to arount 4
MBps. This may have happened when I mounted the drives under linux on my PC
- I have no idea how. You might still be fine if you don't mount the drives
on other systems. Good luck!
InBonobo said…
I used to get the same error as well prior to trying point 6. Have you
tried swapoff, smb off and umount -a?

If yes, try "swapoff /dev/sd?1" instead of sdb1. What the error
message is saying is that the drives are in use by some processes that
are messing around with them. Before finalizing your work, you need to
stop these processes so that you can "save" your work with "hd_verify
InBonobo said…
No problem. Cheers! :)
Nick said…
Just for reference, I had to modify things slightly to get this to work.

1) If no prompt appears after entering 'login root' and it just sits with the busybox message, type 5784468 and hit enter. It should bring up the prompt.

2) I did not have some libraries installed for the fdisk linked. I had to grab them from http://forum.dsmg600.info/attachment.php?item=574 and move the 2 *.so.0 files to /ffp/lib before fdisk would properly function.
Nick said…
I didn't compile anything, just needed to make sure the library files were in place. My fdisk got segfaults. The information I posted is taken from the guide regarding a RAID1 setup that you linked to and helped me get this setup.
Jonas Kamleh said…
Hi there,

Completely new to this - would it be possible to format the WD drive in an external hard drive case (using some program) and then putting it into the DNS?

InBonobo said…
The short answer is no. If you use the Single Drives format option in the DNS, you might be able to take the drive out later on and mount it in a Linux system.
Devil-tux said…

vielen, vielen Dank für die wirklich sehr gute Anleitung und die Veröffentlichung hier. Funktioniert perfekt!

I'm also a "Oldtimer"

Best regards
InBonobo said…
Bitte sehr :)
InBonobo said…
No problem. Cheers! :)
InBonobo said…
It seems unnecessarily complicated.. I managed to just use the fdisk
provided, no need to compile or anything of that sort...
InBonobo said…
Rather than install libraries, is it not simpler to install the fdisk
compiled without said libraries, especially when it has a smaller filesize
and it works? (the link is in the text)
Dim Pan said…

I "landed" here because I am yet another "victim" with the same problem.

I found a good price on the WD20EARS and bought two with the intention to use them in my DNS-323. I did check the D-Link firmware page, first, and found that I had to upgrade from 1.06 to 1.09 (or at least 1.08) in order for a 2T drive to be recognized. I now regret I did not "dig" deeper, however D-Link should have put a warning on the DNS-323 page, a lot of people like myself are suffering today and could have been "saved".

Anyway, there was a rumor in mid February 2011 that D-Link would come out with an updated firmware (1.10 maybe?) solving this 4K issue. However, it is now late March and no new firmware has been posted.

I do not want to bother you with my self-pity, $180 spend for practically two (very nice) paper weights seemed a bit extravagant, but if you can please try to help me out:

1. Does anyone truly know if D-Link is actually and actively working on a new updated firmware that will solve this problem? Is there -even- a BETA firmware out, guys I am just desperate!

2. If a new firmware is not in sight, at least not in the near future, what is my best option in order to be able to use these drives in my NAS-323 as RAID-1? I am not interested in RAID-0 at all, so if RAID-1 is not possible, I would certainly entertain workarounds using either two independent drives, or JBOD, provided that the solution incorporates some kind of data duplication, within the DNS-323. It just does not make sense to have a NAS without some -even basic- form of redundancy or backup.

I sincerely thank you in advance for your response.

Dim Pan
Chicago, IL - USA.
InBonobo said…
1. I hope that D-Link is working on such firmware, but I strongly doubt it. The WD-EARS are not designed to be used in a NAS, they are made for desktop computers, so D-Link probably feels that if you use such a HD is not as intended by the manufacturer, so they don't need to accommodate you.
2. There is a guide at the end of the article showing exactly how to do RAID1. However, as explained in my DNS-323 hacking guide, it makes more sense to use individiual drives (not RAID) and the use a nightly cron script to duplicate only data that is important to you among them.
Good luck!

Popular posts from this blog