NAS Upgrade, new drives!

This post is more of a reminder to myself on upgrading and rebuilding the RAID on these new drives before I forget.

This is what I did on the parted front to set up the new clean HDDs.

~# parted -a optimal /dev/sdc
(parted) mklabel gpt
(parted) mkpart primary 1MB 6TB
(parted) set 1 raid on
(parted) quit

Rince and repeat for all drives. Then check them out with mdadm (sure, you can use hardware RAID if you have more faith in it, i don’t)

~#  mdadm -E /dev/sd[b-e]
/dev/sdb:
   MBR Magic : aa55
Partition[0] :   4294967295 sectors at            1 (type ee)
/dev/sdc:
   MBR Magic : aa55
Partition[0] :   4294967295 sectors at            1 (type ee)
/dev/sdd:
   MBR Magic : aa55
Partition[0] :   4294967295 sectors at            1 (type ee)
/dev/sde:
   MBR Magic : aa55
Partition[0] :   4294967295 sectors at            1 (type ee)

Let’s create the RAID for the drives, this will take a very long time to complete, so go to bed, and check it out the next day.

mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

Check the progress:

~# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid6 sde1[3] sdd1[2] sdc1[1] sdb1[0]
      11720779776 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/4] [UUUU]
      [>....................]  resync =  0.1% (10083584/5860389888) finish=574.8min speed=169611K/sec
      bitmap: 44/44 pages [176KB], 65536KB chunk

unused devices: <none>

You can detail the raid to make sure it looks good:

~# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Tue Nov 17 21:38:06 2015
     Raid Level : raid6
     Array Size : 11720779776 (11177.81 GiB 12002.08 GB)
  Used Dev Size : 5860389888 (5588.90 GiB 6001.04 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Tue Nov 17 21:40:44 2015
          State : clean, resyncing
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 512K

  Resync Status : 0% complete

           Name : belial:0  (local to host belial)
           UUID : 95dadcec:5bbf183d:eab5aaff:fc3aa00d
         Events : 31

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8       49        2      active sync   /dev/sdd1
       3       8       65        3      active sync   /dev/sde1

Last but not least, save the config because it does not create it by default:

mdadm --detail --scan --verbose >> /etc/mdadm/mdadm.conf

That is it.