Why?


Search This Blog

Sunday, August 7, 2016

CentOS 7 build btrfs raid10

CentOS 7 build btrfs raid10

I have 8 3TB WD Red SATA drives for this array. sdb through sdi.

My boot and OS drive is a an 850 EVO SSD on sda.

The 8 WD drives are on a Supermicro AOC-SAS2LP-MV8 Add-on Card, 8-Channel SAS/SATA Adapter with 600MB/s per Channel in a PCIE x16 running at x8 on a Supermicro ATX DDR4 LGA 1151 C7Z170-OCE-O Motherboard with 64GB DDR4 RAM and a dual Intel Ethernet CNA using SFP+ DACs

Prepping drives for new partition by removing old stuff

NOTE** if you have drives from an array you will more than likely need to remove the super block from them.
wipefs -a /dev/sdb
wipefs -a /dev/sdc
wipefs -a /dev/sdd
wipefs -a /dev/sde
wipefs -a /dev/sdf
wipefs -a /dev/sdg
wipefs -a /dev/sdh
wipefs -a /dev/sdi

**END of NOTE

dd if=/dev/zero of=/dev/sdb bs=1024 count=1024
dd if=/dev/zero of=/dev/sdc bs=1024 count=1024
dd if=/dev/zero of=/dev/sdd bs=1024 count=1024
dd if=/dev/zero of=/dev/sde bs=1024 count=1024
dd if=/dev/zero of=/dev/sdf bs=1024 count=1024
dd if=/dev/zero of=/dev/sdg bs=1024 count=1024
dd if=/dev/zero of=/dev/sdh bs=1024 count=1024
dd if=/dev/zero of=/dev/sdi bs=1024 count=1024

reboot

ls -lsa /dev/sd*
0 brw-rw---- 1 root disk 8,   0 Aug  6 19:26 /dev/sda
0 brw-rw---- 1 root disk 8,   1 Aug  6 19:26 /dev/sda1
0 brw-rw---- 1 root disk 8,   2 Aug  6 19:26 /dev/sda2
0 brw-rw---- 1 root disk 8,   3 Aug  6 19:26 /dev/sda3
0 brw-rw---- 1 root disk 8,  16 Aug  6 19:26 /dev/sdb
0 brw-rw---- 1 root disk 8,  32 Aug  6 19:26 /dev/sdc
0 brw-rw---- 1 root disk 8,  48 Aug  6 19:26 /dev/sdd
0 brw-rw---- 1 root disk 8,  64 Aug  6 19:26 /dev/sde
0 brw-rw---- 1 root disk 8,  80 Aug  6 19:26 /dev/sdf
0 brw-rw---- 1 root disk 8,  96 Aug  6 19:26 /dev/sdg
0 brw-rw---- 1 root disk 8, 112 Aug  6 19:26 /dev/sdh
0 brw-rw---- 1 root disk 8, 128 Aug  6 19:26 /dev/sdi

Creating RAID array

[root@nas /]# mkfs.btrfs -f -m raid10 -d raid10 -L myraid /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi
btrfs-progs v3.19.1
See http://btrfs.wiki.kernel.org for more information.

Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
Turning ON incompat feature 'skinny-metadata': reduced-size metadata extent refs
adding device /dev/sdc id 2
adding device /dev/sdd id 3
adding device /dev/sde id 4
adding device /dev/sdf id 5
adding device /dev/sdg id 6
adding device /dev/sdh id 7
adding device /dev/sdi id 8
fs created label myraid on /dev/sdb
        nodesize 16384 leafsize 16384 sectorsize 4096 size 21.83TiB

       
Check filesystem

[root@nas ~]# btrfs filesystem show
Label: 'myraid'  uuid: 1c556918-451a-4182-a2d7-f361e5177f30
        Total devices 8 FS bytes used 5.55GiB
        devid    1 size 2.73TiB used 3.02GiB path /dev/sdb
        devid    2 size 2.73TiB used 3.00GiB path /dev/sdc
        devid    3 size 2.73TiB used 3.00GiB path /dev/sdd
        devid    4 size 2.73TiB used 3.00GiB path /dev/sde
        devid    5 size 2.73TiB used 3.00GiB path /dev/sdf
        devid    6 size 2.73TiB used 3.00GiB path /dev/sdg
        devid    7 size 2.73TiB used 3.00GiB path /dev/sdh
        devid    8 size 2.73TiB used 3.00GiB path /dev/sdi

[root@nas ~]# lsblk --output NAME,KNAME,SIZE,TYPE,MOUNTPOINT,LABEL,UUID,PARTLABEL,PARTUUID
NAME   KNAME   SIZE TYPE MOUNTPOINT LABEL  UUID                                   PARTLABEL    PARTUUID
sda    sda   119.2G disk
├─sda1 sda1    200M part /boot/efi         D03D-8249                              EFI System Partition
                                                                                               340a2110-2a4e-4632-aaf2-589c666a0e82
├─sda2 sda2    500M part /boot             1b85b52d-da28-49c0-a27a-ead6546c0229                47986551-0653-415d-aa8c-cdbe703ac889
└─sda3 sda3  118.6G part                   GPOH5s-Rj85-yNVT-hprF-0pg2-6cOC-DUDwnk              72d5c3be-8720-48ce-b9c5-5864b49c812c
  ├─centos_nas-swap
       dm-0   11.9G lvm  [SWAP]            08f5d728-5412-4693-8ce7-1bfcddfa098f
  ├─centos_nas-root
       dm-1     50G lvm  /                 81ccf919-f113-41a7-85f6-14dd838999bf
  └─centos_nas-home
       dm-2   56.6G lvm  /home             b7577e12-c4f5-46e9-8498-490744cf0da1
sdb    sdb     2.7T disk /myraid    myraid 1c556918-451a-4182-a2d7-f361e5177f30
sdc    sdc     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30
sdd    sdd     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30
sde    sde     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30
sdf    sdf     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30
sdg    sdg     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30
sdh    sdh     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30
sdi    sdi     2.7T disk            myraid 1c556918-451a-4182-a2d7-f361e5177f30

       

Mount Array

mkdir /myraid
mount /dev/sdb /myraid

Persistent mount on reboot
Use the UUID from the "btrfs filesystem show" above

vi /etc/fstab
UUID=1c556918-451a-4182-a2d7-f361e5177f30   /myraid   btrfs  defaults,compress=lzo,autodefrag,x-systemd.device-timeout=0  0 0


Check for fstab errors

mount -av

reboot


Make sure you have a mount

[root@nas myraid]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/centos_nas-root   50G  4.8G   46G  10% /
devtmpfs                      32G     0   32G   0% /dev
tmpfs                         32G  4.0K   32G   1% /dev/shm
tmpfs                         32G  8.9M   32G   1% /run
tmpfs                         32G     0   32G   0% /sys/fs/cgroup
/dev/sda2                    497M  301M  197M  61% /boot
/dev/sda1                    200M  9.5M  191M   5% /boot/efi
/dev/sdb                      11T  5.6G   11T   1% /myraid
/dev/mapper/centos_nas-home   57G  2.0G   55G   4% /home
tmpfs                        6.3G     0  6.3G   0% /run/user/0


[root@nas myraid]# mount -av
/                        : ignored
/boot                    : already mounted
/boot/efi                : already mounted
/home                    : already mounted
swap                     : ignored
mount: /dev/sdc is already mounted or /myraid busy



No comments:

Post a Comment