{"id":803,"date":"2012-11-19T02:30:09","date_gmt":"2012-11-19T02:30:09","guid":{"rendered":"https:\/\/www.mikekirk.org\/wordpress\/?p=803"},"modified":"2013-04-08T20:46:13","modified_gmt":"2013-04-09T00:46:13","slug":"using-3tb-drives-in-your-d-link-dns-323","status":"publish","type":"post","link":"https:\/\/www.mikekirk.org\/wordpress\/using-3tb-drives-in-your-d-link-dns-323\/","title":{"rendered":"Using 3TB drives in your D-Link DNS-323"},"content":{"rendered":"<p><strong>[Recovered: Original post date June 24th 2012]<\/strong><\/p>\n<p>I\u00e2\u20ac\u2122ve been using my <a href=\"http:\/\/www.dlink.com\/ca\/en\/support\/faqs\/network-storage-backup\/nas\/dns-series\/dns-323\">D-Link DNS-323<\/a> as a place to store backups in our apartment, but space has been getting a little tight. Hard drive prices haven\u00e2\u20ac\u2122t come back down to their historic lows, but as 3TB (3TiB?) models can be found for $149 here in Toronto I decided to pick up a pair to use in the upgrade.<\/p>\n<p>There was one problem: the DNS-323 was designed and shipped back when 1TB drives were the norm, and it couldn\u00e2\u20ac\u2122t \u00e2\u20ac\u0153see\u00e2\u20ac\u009d any larger than 2TB. How to get around this? Aftermarket firmware to the rescue! The <a href=\"https:\/\/sites.google.com\/site\/altfirmware\/\">\u00e2\u20ac\u0153Alt-F\u00e2\u20ac\u009d project<\/a> provides new firmware with many new features, including the internal software versions required to use large drives.<\/p>\n<p>First I logged in to the admin interface (with the old D-Link v1.10 firmware) and pointed it to the \u00e2\u20ac\u0153Alt-F-0.1RC2.bin\u00e2\u20ac\u009d file I had downloaded, then clicked Apply and rebooted it when complete:<\/p>\n<p>When it came back up I logged in again, but this time the D-Link web theme was gone, and replaced with the Alt-F admin pages. After stepping through a first-boot wizard that asked for things like timezone, IP settings and hostname\/workgroup I was glad to see it had picked my old drives (sda and sdb, the old 1.5TB SATA models)<\/p>\n<p>I used the System\u00e2\u20ac\u201cUtilities page to shut down the enclosure, and swapped in my two new 3TB drives. I chose the Seagate Barracuda (ST3000DM001) SATA3 64MB-cache versions, which I was going to run as a mirror for redundancy. Booted up and there they were: showing up with \u00e2\u20ac\u01533000.6 GB\u00e2\u20ac\u009d of space:<\/p>\n<p>From reading the Alt-F forums I knew the admin UI had issues running the standard disk utils on large drives (<a href=\"https:\/\/groups.google.com\/forum\/?fromgroups=#!topic\/alt-f\/N0G-X1zp4jg\">see forum instructions here<\/a>), so I SSH\u00e2\u20ac\u2122d in directly using <a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/\">Putty<\/a> (user: root, password: same-as-web-ui). These are the commands I ran against the first disk (\u00e2\u20ac\u0153\/dev\/sda\u00e2\u20ac\u009d)<\/p>\n<p><font color=#FFCC00><strong># sgdisk \u00e2\u20ac\u201czap-all \/dev\/sda<\/strong><br \/>\nCreating new GPT entries.<br \/>\nGPT data structures destroyed! You may now partition the disk using fdisk or<br \/>\nother utilities.<br \/>\n<strong># sgdisk \u00e2\u20ac\u201cset-alignment=8 \u00e2\u20ac\u201cnew=1:64:+512M \u00e2\u20ac\u201ctypecode=1:8200 \/dev\/sda<\/strong><br \/>\nCreating new GPT entries.<br \/>\nThe operation has completed successfully.<br \/>\n<strong># end=$(sgdisk \u00e2\u20ac\u201cset-alignment=8 \u00e2\u20ac\u201cend-of-largest \/dev\/sda)<br \/>\n# sgdisk \u00e2\u20ac\u201cset-alignment=8 \u00e2\u20ac\u201cnew=2:0:${end} \u00e2\u20ac\u201ctypecode=2:8300 \/dev\/sda<\/strong><br \/>\nThe operation has completed successfully.<br \/>\n<strong># sgdisk -p \/dev\/sda<\/strong><br \/>\nDisk \/dev\/sda: 5860533168 sectors, 2.7 TiB<br \/>\nLogical sector size: 512 bytes<br \/>\nDisk identifier (GUID): D07A22ED-A279-4FC8-B0F6-133DF4450139<br \/>\nPartition table holds up to 128 entries<br \/>\nFirst usable sector is 34, last usable sector is 5860533134<br \/>\nPartitions will be aligned on 64-sector boundaries<br \/>\nTotal free space is 30 sectors (15.0 KiB)<\/p>\n<p>Number Start (sector) End (sector) Size Code Name<br \/>\n1 64 1048639 512.0 MiB 8200<br \/>\n2 1048640 5860533134 2.7 TiB 8300<\/font><\/p>\n<p>I then repeated the commands for the second disk (\u00e2\u20ac\u0153\/dev\/sdb\u00e2\u20ac\u009d):<\/p>\n<p><font color=#FFCC00><strong># sgdisk \u00e2\u20ac\u201czap-all \/dev\/sdb<\/strong><br \/>\nCreating new GPT entries.<br \/>\nGPT data structures destroyed! You may now partition the disk using fdisk or<br \/>\nother utilities.<br \/>\n<strong># sgdisk \u00e2\u20ac\u201cset-alignment=8 \u00e2\u20ac\u201cnew=1:64:+512M \u00e2\u20ac\u201ctypecode=1:8200 \/dev\/sdb<\/strong><br \/>\nCreating new GPT entries.<br \/>\nThe operation has completed successfully.<br \/>\n<strong># end=$(sgdisk \u00e2\u20ac\u201cset-alignment=8 \u00e2\u20ac\u201cend-of-largest \/dev\/sdb)<br \/>\n# sgdisk \u00e2\u20ac\u201cset-alignment=8 \u00e2\u20ac\u201cnew=2:0:${end} \u00e2\u20ac\u201ctypecode=2:8300 \/dev\/sdb<\/strong><br \/>\nThe operation has completed successfully.<br \/>\n<strong># sgdisk -p \/dev\/sdb<\/strong><br \/>\nDisk \/dev\/sdb: 5860533168 sectors, 2.7 TiB<br \/>\nLogical sector size: 512 bytes<br \/>\nDisk identifier (GUID): 674BA261-9F48-47A4-9A19-8C63889CAFA8<br \/>\nPartition table holds up to 128 entries<br \/>\nFirst usable sector is 34, last usable sector is 5860533134<br \/>\nPartitions will be aligned on 64-sector boundaries<br \/>\nTotal free space is 30 sectors (15.0 KiB)<\/p>\n<p>Number Start (sector) End (sector) Size Code Name<br \/>\n1 64 1048639 512.0 MiB 8200<br \/>\n2 1048640 5860533134 2.7 TiB 8300<\/font><\/p>\n<p>Then I activated the swap partitions on both disks:<\/p>\n<p><font color=#FFCC00><strong># mkswap \/dev\/sda1<\/strong><br \/>\nSetting up swapspace version 1, size = 536866816 bytes<br \/>\n<strong># mkswap \/dev\/sdb1<\/strong><br \/>\nSetting up swapspace version 1, size = 536866816 bytes<br \/>\n<strong># swapon \/dev\/sda1<br \/>\n# swapon \/dev\/sdb1<\/strong><\/font><\/p>\n<p>Next, I couldn\u00e2\u20ac\u2122t tell from the forum if I should even try using the web UI to mirror the disks (since the page showed an error), so I mirrored them from the command line. Note: This command uses the latest metadata format that is too new for the OEM D-Link firmware \u00e2\u20ac\u201c if you think you may want to go back to the original firmware one day don\u00e2\u20ac\u2122t use this command! (and use the next one below it instead):<\/p>\n<p><font color=#FFCC00><strong># mdadm \u00e2\u20ac\u201ccreate \/dev\/md0 \u00e2\u20ac\u201cbitmap=internal<br \/>\n\u00e2\u20ac\u201cchunk=64 \u00e2\u20ac\u201clevel=raid1 \u00e2\u20ac\u201craid-devices=2 \/dev\/sda2 \/dev\/sdb2<\/strong><br \/>\nmdadm: Note: this array has metadata at the start and<br \/>\nmay not be suitable as a boot device. If you plan to<br \/>\nstore \u00e2\u20ac\u02dc\/boot\u00e2\u20ac\u2122 on this device please ensure that<br \/>\nyour boot-loader understands md\/v1.x metadata, or use<br \/>\n\u00e2\u20ac\u201cmetadata=0.90<br \/>\nContinue creating array? y<br \/>\nmdadm: Defaulting to version 1.2 metadata<br \/>\nmdadm: array \/dev\/md0 started.<\/font><\/p>\n<p>If you wanted to use the older metadata format that would allow you to flash back to D-Link defaults, add the \u00e2\u20ac\u0153\u00e2\u20ac\u201cmetadata=0.90\u00e2\u20ac\u00b3 flag, like this:<\/p>\n<p><font color=orange><strong># mdadm \u00e2\u20ac\u201ccreate \/dev\/md0 \u00e2\u20ac\u201cbitmap=internal<br \/>\n\u00e2\u20ac\u201cmetadata=0.90 \u00e2\u20ac\u201cchunk=64 \u00e2\u20ac\u201clevel=raid1 \u00e2\u20ac\u201craid-devices=2 \/dev\/sda2 \/dev\/sdb2<\/strong><\/font><\/p>\n<p>You can check if the two disks are starting to be stitched together with the \u00e2\u20ac\u0153cat \/proc\/mdstat\u00e2\u20ac\u009d command. You should see the word \u00e2\u20ac\u0153resync\u00e2\u20ac\u009d with an estimated finish time. (Note: it may take hours, but you don\u00e2\u20ac\u2122t have to wait for it to complete before performing the next steps).<\/p>\n<p><font color=#FFCC00><strong># cat \/proc\/mdstat<\/strong><br \/>\nPersonalities : [linear] [raid1]<br \/>\nmd0 : active raid1 sdb2[1] sda2[0]<br \/>\n2929741087 blocks super 1.2 [2\/2] [UU]<br \/>\n[==>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;] resync = 11.3% (331414528\/2929741087) finish=41952.7min speed=1031K\/sec><\/font><\/p>\n<p>Next I switched back to the Alt-F web UI to create an EXT4 filesystem on top of the new \/dev\/md0 mirror. (Think of \/dev\/md0 as the name for the combination of your \/dev\/sda and \/dev\/sdb disks). This also could have done from the terminal, but I wanted to use point-and-click \ud83d\ude42<\/p>\n<p>Because the two disks are still being joined, filesystem creation can take a long time (for me about 45 minutes). You can see that it\u00e2\u20ac\u2122s working by running \u00e2\u20ac\u0153top\u00e2\u20ac\u009d in your terminal and looking for \u00e2\u20ac\u0153mkfs.ext4\u00e2\u20ac\u00b3:<\/p>\n<p>You can also monitor the progress from the status page:<\/p>\n<p>After it completed I made one last change: I ran a command to prevent the enclosure from saving so much extra space (almost 150GB) for the \u00e2\u20ac\u0153root\u00e2\u20ac\u009d user. On regular Linux system space is reserve so even if regular users fill the disk an admin still has room to fix things\u00e2\u20ac\u00a6 but that doesn\u00e2\u20ac\u2122t really apply for home use since even if the DNS-323 gets full it\u00e2\u20ac\u2122s not booting from those disks so there\u00e2\u20ac\u2122s little consequence:<\/p>\n<p><font color=#FFCC00><strong># tune2fs -m 0 \/dev\/md0<\/strong><br \/>\ntune2fs 1.41.14 (22-Dec-2010)<br \/>\nSetting reserved blocks percentage to 0% (0 blocks)<\/font><\/p>\n<p>Success! The status page shows the formatted base-2 capacity of the mirror as 2.7TB (and you can also see the resync on md0 is still happening under-the-covers)<\/p>\n<p>Many people are done at this point, but I needed to share the new space back out to my network using the same share name as when I was running D-Link firmware (\u00e2\u20ac\u0153Volume_1\u00e2\u20ac\u00b3)<\/p>\n<p>Note: If you hadn\u00e2\u20ac\u2122t been using \u00e2\u20ac\u0153user\u00e2\u20ac\u009d accounts with Samba and the old firmware, you may need to SSH in one more time to run this command to let people save files to the share.<\/p>\n<p><font color=#FFCC00><strong># chmod 777 \/mnt\/md0<\/strong><\/font><\/p>\n<p><strong>Warning:<\/strong> This command effectively says \u00e2\u20ac\u0153anyone can change anything\u00e2\u20ac\u009d on the share. Probably OK for home use, but not the type of security you would use in a business.<\/p>\n<p>Finally: I could see it in Windows, hooray!<\/p>\n<p>Special thanks to Joao Caroso from the Alt-F project and the other users that figured all this out before me in the forums!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Recovered: Original post date June 24th 2012] I\u00e2\u20ac\u2122ve been using my D-Link DNS-323 as a place to store backups in our apartment, but space has been getting a little tight. Hard drive prices haven\u00e2\u20ac\u2122t come back down to their historic <a class=\"more-link\" href=\"https:\/\/www.mikekirk.org\/wordpress\/using-3tb-drives-in-your-d-link-dns-323\/\">Continue reading <span class=\"screen-reader-text\">  Using 3TB drives in your D-Link DNS-323<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[6],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/ptY4v-cX","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/posts\/803"}],"collection":[{"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/comments?post=803"}],"version-history":[{"count":6,"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":805,"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/posts\/803\/revisions\/805"}],"wp:attachment":[{"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/media?parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/categories?post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mikekirk.org\/wordpress\/wp-json\/wp\/v2\/tags?post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}