The Blog

QNAP TS-212 – How to save RAID settings from shell Posted on

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, which is quite boring.

Here is how to delete partition table:

Check which disk is used as RAID to avoid a “wrong” delete
mdadm –detail /dev/md0 Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 3 1 active sync /dev/sda3

So we need to clean the /dev/sdb partitions
fdisk -l /dev/sdb
Disk /dev/sdb: 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 66 530125 83 Linux
/dev/sdb2 67 132 530142 83 Linux
/dev/sdb3 133 121538 975193693 83 Linux
/dev/sdb4 121539 121600 498012 83 Linux

Dismount the volume before starting the work
umount /dev/sdb3

So we have 4 partition, type the follow to enter in fdisk mode
fdisk /dev/sdb

If you need help type “m”

List all partition as above, type “p”
Command (m for help): p Disk /dev/sdb: 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 66 530125 83 Linux
/dev/sdb2 67 132 530142 83 Linux
/dev/sdb3 133 121538 975193693 83 Linux
/dev/sdb4 121539 121600 498012 83 Linux

Press “p” to delete partitions and the number of partition to delete
Command (m for help): d
Partition number (1-4): 1

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

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

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

Print all partitions of the disk with “p”
Command (m for help): p
Disk /dev/sdb: 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

Save the changes with “w”

You need to save RAID settings information in the /etc/config/raidtab file

Change raidtab file like this one
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
chunk-size 4
persistent-superblock 1
device /dev/sda3
raid-disk 0
device /dev/sdb3
raid-disk 1

Change also /etc/storage.conf file
Set it only for RAID volume and clear all reference for single volume
[VOLUME 1]
device name = /dev/md0
raid level = 1
raid disks = 1,0
spare raid disks =
status = 0
record_time = Thu Jul 19 22:53:14 2012

filesystem = 104
[Global]
Available Disk = 2

This entry was posted in Uncategorized. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code