** IMPORTANT: This is the first posting of this guide and I recommend only advanced users with some linux knowledge use it until it gets a bit more community feedback. This information is provided by me (tentimes) as a user and I am NOT a member of dlink staff, nor is this an official support document from dlink - use at your own risk! **Please note this from Stan:
Tentimes,
Thank you so much for the helpful guide. I bought the 321 on sale at Tiger Direct and based on the success stories documented in this thread got a couple 1.5TB EARS drives to go in it.
I had exactly the same problem as Avenger when following the instructions, and the solution proposed by grixx was the answer. Maybe the guide should be updated to say that if you are going to be formatting two brand new drives you have to insert both and let the DLink format them otherwise it does not expect to be using two separate drives. When done exactly according to the instructions in the guide, I only got Volume 1 to show up.
IntroductionThis guide shows how to install a 4k sector "advanced format" drive in the DNS-323 (for example the new WD EARS drives). It is intended for standalone drives; i.e. both drives separate, not JBOD or RAID.
I will amend later for JBOD if someone can tell me how the 323 sets up the partitions for this. In theory if I had the partition info for RAID it could be updated for that too, but given that in the case of WD drives the TLER bit is disabled there seems little point at the moment. There is a guide on doing it with RAID though here: http://cellushun.co.tv/swapon-device-or-resource-busyYou don't really need to know linux, but I would not recommend this procedure for the totally clueless - just in case. It requires formating the drive(s) you are adding, so if you already have an advanced drive with stuff on it you will need to back that up and replace the data after "fixing" the drive. This method can be used to add one "4k sector" drive, or adding a set of drives.
This is definitely not all my own work, a lot is based on Consumed Consumer's blog, which you can read here:
http://www.consumedconsumer.org/2010/06/upgrading-my-dns-323-to-2-x-2-tb-ii_08.htmlI have used a different method to format the drives that I hope should work regardless of the size of the drive being added.
Before you startWarning! Make sure you check and double check which drive you (a) Physically put into the drive bay, and (b) are writing commands to when formatting. I can't stress this enough - I have wiped a drive before by formatting the wrong one by mistake (got my left and right mixed up!) It is also possible to format the wrong drive from software with a typo. Here is a guide to which drive is which, as you look at the front of the NAS where the purdy blue lights are:
LEFT disk 2 RIGHT disk 14k Sect. Drive
/Advanced Format
HD_
b1/2/4 HD_
a1/2/4
sd
b1/2/4 sd
a1/2/4
Funplug Bootstrap here!
Format this
DON'T Format this!!!!Check which drive is in which slot by using the status section of the DNS-323 web interface. 1 & 2 correspond to the diagram above. I would also recommend physically marking the drives with a sticker or something.
Firmware: Make sure you have the NAS updated to firmware version 1.08. There is a guide for this on the dlink support site.
Changing drives: The NAS
must be powered down to change a drive. You can do this via the web interface or by pressing the front button.
Funplug: Funplug is a small program which gives you access to the linux command line on the DNS-323. You will need to install it to use this method of formatting your 4k sector drive(s). Once this procedure is over you can either forget about it (having secured it) or use it to play about with your 323. It's great fun, doesn't alter the BIOS/Firmware and is a good introduction to linux if you haven't played with this stuff before. There are addons for allowing a USB drive, soundcard and all other sorts of stuff if you are so inclined.
Putty: You will need the windows SSH client "Putty" which you can download here:
http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe
FDISK update: Download an updated FDISK, which is compatible with 4k sector drives, and store it somewhere for now:
http://forum.dsmg600.info/attachment.php?item=393Code sections: I've used the forums code formating to show the bits where you need to type stuff. Anything in square brackets is just me commenting on that line you are typing in.
4k Sectors: (For nerds only

) Although the physical sectors on the disk are 4k, the drive reports them as 512 Bytes in length, which means that any numbers you see when looking at the partition table in FDISK might not seem to make sense if you try and convert them to physical numbers. It took much wailing and gnashing of teeth to work out the right logical partition sizes. I don't think the NAS care's too much, but I tried to get them as close to the original as possible for the swap and mystery partition once scaled to 4k sectors.
The procedure( 1 ) If you are adding TWO new 4k sector drives: remove any existing drives and hide so you can't format them by mistake! Add the first of the new drives to the RIGHT bay, boot up the NAS and use the web interface to format drive 1 (standalone, not JBOD or RAID). At this point it will be formatted with the wrong cylinder boundaries, but it will do for now.
( 2 ) If you are adding ONE drive then make sure the drive being added is going to the LEFT bay. This may mean moving the drive you are keeping to the RIGHT bay and clearing the left slot for our new drive.
( 3 ) Add the new drive to the left bay (or add the next drive to the left bay if you are installing two new 4k sector drives). Boot up the NAS. If the new drive is unformatted then you will be prompted to format it. If so, hit SKIP - we do not want to format this drive using the web interface. At this point click on the status section of the web interface and check the drives are in the right place.
( 4 ) We now need to add Funplug. Rather than me typing it all out again, please go to the following link, install and follow the instructions all the way to the point where you have a working SSH login from windows. NB: It says CH3NAS - don't worry, it's the same process for the 323. You want to
install it on Volume 1, the RIGHT side drive - we will be formatting the LEFT drive and running linux commands from the right drive: Here's the link:
http://nas-tweaks.net/CH3SNAS:Tutorials/fun_plug
( 5 ) Unzip the fdisk file you downloaded earlier to the root directory of Volume 1 (RIGHT drive). We will rename the file fdisk in the /ffp/sbin folder to fdisk.old, add the new one, then make it executable.
Connect via SSH to the NAS, by running putty on your windows machine, and login as root with the password you made in the step above. Then use these commands:
cd /mnt/HD_a2/ffp/sbin
mv fdisk fdisk.old
mv ../../fdisk .
chmod +x fdisk
That third line: it's fdisk then a space then a dot. Note that we are working with HD_a2, which is the second (also the main and visible) partition of drive a (drive 1) which is in the right hand bay, where we will be running our linux commands from. You could just copy these lines over by copying each line from here and then a right click in putty will paste whats in the clipboard. Typing 'ls' is the same as 'dir' in dos. You can also use 'cd ..' to go up a directory level or '../..' to get to the root directory in the syntax. Just throwing that in in case you want to look around the directories a bit and see what's going on
( 6 ) Next we need to un-mount any partitions on the new drive we just inserted, drive 2 (on the left hand side of the NAS as we look at it) and also stop the samba file system so nothing on the network can interfere with the drive we are reformatting. You don't need to type the 'umount' lines if the drive you are adding is unformatted:
smb stop
nfs stop
umount /mnt/HD_b2
umount /mnt/HD_b4
umount /mnt/HD_b1
swapoff /dev/sdb1
These commands might give errors if any of those partitions aren't mounted. If so, don't worry: if they aren't mounted, they aren't mounted
( 7 ) If there are any partitions on Disk 2 then we need to delete them. Firstly start fdisk and list the partitions:
fdisk -H 224 -S 56 /dev/sdb
p
At this point if it shows no partitions press CTRL+C to exit FDISK and go to the next step. Otherwise, you need to delete the partitions. For each partition use the 'd' command, for example to erase partition 2 type:
d
2
When you have finished deleting we need to write the partition table, just type:
w
Check again the partitions are gone by typing p to print (list) the partition list. If they are all gone you can exit the FDISK program by pressing CTRL+C
( 8 ) Now we partition the drive so that it is useable by the NAS but also is aligned to 4k sectors. The partitions are numbered 1,2 and 4 (binary) Partition 1 is the swap, needed in case this will be Drive 1 in the NAS, as linux will need a swap partition. Partition 2 is the one that is visible and stores all your files, partition 4... well I have no idea what this is for, but the NAS needs it for something! After we set the partitions we will list them to check they are correct, then finalise. Keep in mind that the order on disk of the partitions is: 1,4,2. Make sure you partition sd
b NOT sda!
fdisk -H 224 -S 56 /dev/sdb
n
p [for primary partition]
1 [in response to choose partition]
1 [when asked for first cylinder]
85 [when asked for last cylinder]
n
p
4
86
169
n
p
2
170
[Press enter to accept the default value = last cylinder available]
t
1
82
p
The last bit marks partition 1 as swap. The partitions should be as follows: 1 = start 1, end 85; 4= start 86, end 169; 2 = Start 170, end = [big number depending on drive size}. Now check the readout of partitions to make sure there are no typos and just enter the last command:
w
to commit these partitions and write to the drive. If you make a mistake just enter 'd' to delete a partition, p to show what you have got, and enter it again correctly. Then press CTRL+C to exit FDISK. Next we need to format these three partitions, starting with the swap:
mkswap /dev/sdb1
mke2fs -j -m 0 -T largefile4 /dev/sdb4
mke2fs -j -m 0 -T largefile4 /dev/sdb2
mkswap formats a partition for swap use and mke2fs formats for filesystem use.
Important! the '-j' argument makes it an EXT3 partition (it adds journalling). If you just want EXT2 then leave this argument out. Google EXT2 vs EXT3 for more information on the pro's and con's for this. I don't believe EXT3 will be any slower on the 323, but it is better for repairing errors. The character after 'm' is a zero (no need for super user reserved blocks as only ever root user stuff going on in the NAS). -T specifies the filesystem format, in this case largefile4 is what we need for our 4k sector blocks.
Next we finalise the filesystem, turn it on, and set the swap partition (setting swap in case we are on the second run through this procedure for people adding two drives)
hd_verify -w
smb start
nfs start
swapon /dev/sdb1
Now reboot the NAS using the web interface or by power cycling with the button on the front panel. Remember it takes a couple of minutes for the NAS to come back up
( 9 ) If you have a second drive to add then power down Mr NAS, move the drive in the left bay (2) to the right bay (1), and use steps 3 to 8 to setup this second drive.
( 10 ) When the system has rebooted, use the NAS web interface to check both drives are as they should be, then try some file transfers over your network to each drive to make sure it is working.
And there we have it! Your drive(s) will now be aligned to 4k sectors, meaning it will not suffer the terrible read/write penalties that it would if it was installed using the web interface. This problem is not Dlink's fault though, as they could not have anticipated that HD manufacturers would produce a drive that had a new sector size but reported the wrong sector size to the operating system.
Please keep in mind that this is the first posting of this guide and I will endeavour to update it regularly as people reply.
tentimes
EDIT: Added in the command to set partition 1 to swap (oops!)
EDIT2: Added "swapoff /dev/sdb1" to Step 6, as per Derek Lee, ProfM2 et al