User Tools

Site Tools


nas:build_a_linux_nas:prepare_the_raid_disks

This is an old revision of the document!


NAS - Build a Linux NAS - Prepare the RAID Disks

Determine the available disks

lsblk

returns:

NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0 232.9G  0 disk 
├─sda1                   8:1    0  1007K  0 part 
├─sda2                   8:2    0   512M  0 part /boot/efi
├─sda3                 253:28   0     8G  0 part [SWAP]
├─sda4                 253:29   0    58G  0 part /
sdb                      8:32   0  14.6T  0 disk 
sdc                      8:48   0  14.6T  0 disk 
sdd                      8:64   0  14.6T  0 disk 

NOTE: This shows:

  • sda: The boot disk of the host OS.
  • sdb: A free disk.
  • sdc: A free disk.
  • sdd: A free disk.

The free disks do not have any partitions yet and will be included into a RAID.


Initialize the free disks

sudo fdisk /dev/sdb

returns:

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
Device does not contain a recognized partition table.
The size of this disk is 14.6 TiB (16000900661248 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
 
Created a new DOS disklabel with disk identifier 0xc778227a.
 
Command (m for help): 

Create a GPT Partition

Command (m for help): g

returns:

Created a new GPT disklabel (GUID: 6D811672-A5FE-BA4F-8F79-D17E0285C5E1).

NOTE: GPT (GUID Partition Table) is much better than MBR (Master Boot Record) partitions:

  • GPT supports much larger disks.
  • GPT allows for a nearly unlimited number of partitions.
  • GPT also stores cyclic redundancy check (CRC) values to check that its data is intact.
    • If the data is corrupted, GPT can notice the problem and attempt to recover the damaged data from another location on the disk.

Create a Linux RAID Partition

Command (m for help): n
Partition number (1-128, default 1):     
First sector (2048-31251759070, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-31251759070, default 31251759070): 

returns:

Created a new partition 1 of type 'Linux filesystem' and of size 14.6 TiB.

NOTE: Just taking the default values uses the entire disk.


Command (m for help): p

returns:

Disk /dev/sdb: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: ST16000NM001G-2K
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 6D811672-A5FE-BA4F-8F79-D17E0285C5E1
 
Device     Start         End     Sectors  Size Type
/dev/sdb1   2048 31251759070 31251757023 14.6T Linux filesystem

NOTE: Just taking the default values uses the entire disk.


Change the Partition Type

Command (m for help): t
Selected partition 1
Partition type or alias (type L to list all): 29

returns:

Changed type of partition 'Linux filesystem' to 'Linux RAID'.

NOTE: The type is changed to Linux RAID, which is type 29.


Command (m for help): p

returns:

Disk /dev/sdd: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: ST16000NM001G-2K
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: EAA2F832-9810-AA45-9DDB-8ED531C20139
 
Device     Start         End     Sectors  Size Type
/dev/sdd1   2048 31251759070 31251757023 14.6T Linux RAID

NOTE: This shows the Type has been changed to Linux RAID.


Write the Partition Table

Command (m for help): w

returns:

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Partition other Disks

Repeat the above instructions for the other free disks.


Check the available disks again

lsblk

returns:

NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0 232.9G  0 disk 
├─sda1                   8:1    0  1007K  0 part 
├─sda2                   8:2    0   512M  0 part /boot/efi
├─sda3                 253:28   0     8G  0 part [SWAP]
├─sda4                 253:29   0    58G  0 part /
sdb                      8:32   0  14.6T  0 disk 
├─sdb1                   8:33   0  14.6T  0 part 
sdc                      8:48   0  14.6T  0 disk 
├─sdc1                   8:49   0  14.6T  0 part 
sdd                      8:64   0  14.6T  0 disk 
├─sdd1                   8:65   0  14.6T  0 part 

NOTE: This shows the original free disks all now have partitions.

  • At this point, these disks can be tied together as a RAID array.
nas/build_a_linux_nas/prepare_the_raid_disks.1632585218.txt.gz · Last modified: 2021/09/25 15:53 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki