{"id":771,"date":"2014-12-03T00:12:36","date_gmt":"2014-12-03T05:12:36","guid":{"rendered":"http:\/\/xfloyd.net\/blog\/?p=771"},"modified":"2014-12-03T00:17:30","modified_gmt":"2014-12-03T05:17:30","slug":"qnap-ts-212-how-to-save-raid-settings-from-shell","status":"publish","type":"post","link":"https:\/\/xfloyd.net\/blog\/?p=771","title":{"rendered":"QNAP TS-212 \u2013 How to save RAID settings from shell"},"content":{"rendered":"<p>Scenario = you have wrongly initialize a new HDD a single disk but you would like to be added as RAID1 disk.<\/p>\n<p>QNap support team suggested to remove all partition and reboot NAS<\/p>\n<p>This should be done connecting the second disk to a computer, delete volume and partition, and connect disk back into the NAS, which is quite boring.<br \/>\n<!--more--><br \/>\nHere is how to delete partition table:<\/p>\n<p>Check which disk is used as RAID to avoid a \u201cwrong\u201d delete<br \/>\nmdadm &#8211;detail \/dev\/md0 Number\u00a0Major\u00a0Minor\u00a0RaidDevice State<br \/>\n<code>0\u00a00\u00a00\u00a00\u00a0removed<br \/>\n1\u00a08\u00a03\u00a01\u00a0active sync\u00a0\/dev\/sda3<\/code><\/p>\n<p>So we need to clean the \/dev\/sdb partitions<br \/>\n<code>fdisk -l \/dev\/sdb<br \/>\nDisk \/dev\/sdb: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<\/code><\/p>\n<p><code>Device Boot\u00a0Start\u00a0End\u00a0Blocks\u00a0Id\u00a0System<br \/>\n\/dev\/sdb1\u00a01\u00a066\u00a0530125\u00a083\u00a0Linux<br \/>\n\/dev\/sdb2\u00a067\u00a0132\u00a0530142\u00a083\u00a0Linux<br \/>\n\/dev\/sdb3\u00a0133\u00a0121538\u00a0975193693\u00a083\u00a0Linux<br \/>\n\/dev\/sdb4\u00a0121539\u00a0121600\u00a0498012\u00a083\u00a0Linux<\/code><\/p>\n<p>Dismount the volume before starting the work<br \/>\n<code>umount \/dev\/sdb3<\/code><\/p>\n<p>So we have 4 partition, type the follow to enter in fdisk mode<br \/>\n<code>fdisk \/dev\/sdb<\/code><\/p>\n<p>If you need help type \u201cm\u201d<\/p>\n<p>List all partition as above, type \u201cp\u201d<br \/>\nCommand (m for help): p Disk \/dev\/sdb: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<\/p>\n<p><code>Device Boot\u00a0Start\u00a0End\u00a0Blocks\u00a0Id\u00a0System<br \/>\n\/dev\/sdb1\u00a01\u00a066\u00a0530125\u00a083\u00a0Linux<br \/>\n\/dev\/sdb2\u00a067\u00a0132\u00a0530142\u00a083\u00a0Linux<br \/>\n\/dev\/sdb3\u00a0133\u00a0121538\u00a0975193693\u00a083\u00a0Linux<br \/>\n\/dev\/sdb4\u00a0121539\u00a0121600\u00a0498012\u00a083\u00a0Linux<\/code><\/p>\n<p>Press \u201cp\u201d to delete partitions and the number of partition to delete<br \/>\nCommand (m for help): d<br \/>\nPartition number (1-4): 1<\/p>\n<p>Command (m for help): d<br \/>\nPartition number (1-4): 2<\/p>\n<p>Command (m for help): d<br \/>\nPartition number (1-4): 3<\/p>\n<p>Command (m for help): d<br \/>\nPartition number (1-4): 4<\/p>\n<p>Print all partitions of the disk with \u201cp&#8221;<br \/>\nCommand (m for help): p<br \/>\n<code>Disk \/dev\/sdb: 1000.2 GB, 1000204886016 bytes<br \/>\n255 heads, 63 sectors\/track, 121601 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<\/p>\n<p>Device Boot\u00a0Start\u00a0End\u00a0Blocks\u00a0Id\u00a0System<\/code><\/p>\n<p>Save the changes with \u201cw\u201d<\/p>\n<p>You need to save RAID settings information in the \/etc\/config\/raidtab file<\/p>\n<p>Change raidtab file like this one<br \/>\n<code>raiddev \/dev\/md0<br \/>\nraid-level\u00a01<br \/>\nnr-raid-disks\u00a02<br \/>\nnr-spare-disks\u00a00<br \/>\nchunk-size\u00a04<br \/>\npersistent-superblock\u00a01<br \/>\ndevice\u00a0\/dev\/sda3<br \/>\nraid-disk\u00a00<br \/>\ndevice\u00a0\/dev\/sdb3<br \/>\nraid-disk\u00a01<\/code><\/p>\n<p>Change also \/etc\/storage.conf file<br \/>\nSet it only for RAID volume and clear all reference for single volume<br \/>\n<code>[VOLUME 1]<br \/>\ndevice name = \/dev\/md0<br \/>\nraid level = 1<br \/>\nraid disks = 1,0<br \/>\nspare raid disks =<br \/>\nstatus = 0<br \/>\nrecord_time = Thu Jul 19 22:53:14 2012<\/p>\n<p>filesystem = 104<br \/>\n[Global]<br \/>\nAvailable Disk = 2<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scenario = you have wrongly initialize a new HDD a single disk but you would like to be added as RAID1 disk. QNap support team suggested to remove all partition and reboot NAS This should be done connecting the second disk to a computer, delete volume and partition, and connect disk back into the NAS, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/771"}],"collection":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=771"}],"version-history":[{"count":4,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/771\/revisions"}],"predecessor-version":[{"id":775,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/771\/revisions\/775"}],"wp:attachment":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}