nas:build_a_linux_nas:prepare_the_raid_disks
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
nas:build_a_linux_nas:prepare_the_raid_disks [2021/09/25 15:49] – created peter | nas:build_a_linux_nas:prepare_the_raid_disks [2021/10/12 20:36] (current) – [Test the Disks] peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== NAS - Build a Linux NAS - Prepare the RAID Disks ====== | ====== NAS - Build a Linux NAS - Prepare the RAID Disks ====== | ||
+ | |||
+ | ===== Determine the available disks ===== | ||
+ | |||
+ | <code bash> | ||
+ | lsblk | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | NAME | ||
+ | sda 8:0 0 232.9G | ||
+ | ├─sda1 | ||
+ | ├─sda2 | ||
+ | ├─sda3 | ||
+ | ├─sda4 | ||
+ | sdb 8:32 | ||
+ | sdc 8:48 | ||
+ | sdd 8:64 | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * **sda**: | ||
+ | * **sdb**: | ||
+ | * **sdc**: | ||
+ | * **sdd**: | ||
+ | |||
+ | The free disks do not have any partitions yet and will be included into a RAID. | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Obtain the Serial Numbers of the Disks ===== | ||
+ | |||
+ | <code bash> | ||
+ | hdparm -i /dev/sdd | grep SerialNo | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Model=ST16000NM001G-2KK103, | ||
+ | </ | ||
+ | |||
+ | <WRAP important> | ||
+ | **IMPORTANT: | ||
+ | </ | ||
+ | |||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | The reason for recording the serial number of each disk is that in the case of a disk failure, there needs to be a way to determine which disk has failed and needs to be replaced. | ||
+ | |||
+ | * The enclosure being used for the disks may not support hot-swapping and there may not be a separate light for each disk, so there may not be a straight-forward way to determine which specific disk has failed. | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Test the Disks ===== | ||
+ | |||
+ | All hard drives, both new and old, should be tested before adding them to an array. | ||
+ | |||
+ | See S.M.A.R.T. to view smart data and run smart tests. | ||
+ | |||
+ | Do a short smart test: | ||
+ | |||
+ | <code bash> | ||
+ | smartctl -t short /dev/sdb [-d sat] | ||
+ | </ | ||
+ | |||
+ | Do a long smart test: | ||
+ | |||
+ | <code bash> | ||
+ | smartctl -t long /dev/sdb [-d sat] | ||
+ | </ | ||
+ | |||
+ | Check all smart attributes: | ||
+ | |||
+ | <code bash> | ||
+ | smartctl -a /dev/sdb [-d sat] | ||
+ | </ | ||
+ | |||
+ | Do a random readwrite test: | ||
+ | |||
+ | <code bash> | ||
+ | sudo fio --filename="/ | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** The smartmontools package might be needed to be installed: | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt install smartmontools | ||
+ | </ | ||
+ | |||
+ | * **-d sat**: | ||
+ | |||
+ | See: https:// | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Initialize the free disks ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo fdisk /dev/sdb | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | 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 ==== | ||
+ | |||
+ | <code bash> | ||
+ | Command (m for help): g | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Created a new GPT disklabel (GUID: 6D811672-A5FE-BA4F-8F79-D17E0285C5E1). | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * 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 ==== | ||
+ | |||
+ | <code bash> | ||
+ | Command (m for help): n | ||
+ | Partition number (1-128, default 1): | ||
+ | First sector (2048-31251759070, | ||
+ | Last sector, +/-sectors or +/ | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Created a new partition 1 of type 'Linux filesystem' | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** Just taking the default values uses the entire disk. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Print the Partition ==== | ||
+ | |||
+ | <code bash> | ||
+ | Command (m for help): p | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Disk /dev/sdb: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors | ||
+ | Disk model: ST16000NM001G-2K | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | Disklabel type: gpt | ||
+ | Disk identifier: 6D811672-A5FE-BA4F-8F79-D17E0285C5E1 | ||
+ | |||
+ | Device | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** This shows that there is a single partition, /dev/sdb1, using the entire disk. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Change the Partition Type ==== | ||
+ | |||
+ | <code bash> | ||
+ | Command (m for help): t | ||
+ | Selected partition 1 | ||
+ | Partition type or alias (type L to list all): 29 | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Changed type of partition 'Linux filesystem' | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** The type is changed to Linux RAID, which is type 29. | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Print the Partition again ==== | ||
+ | |||
+ | <code bash> | ||
+ | Command (m for help): p | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | Disk /dev/sdd: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors | ||
+ | Disk model: ST16000NM001G-2K | ||
+ | Units: sectors of 1 * 512 = 512 bytes | ||
+ | Sector size (logical/ | ||
+ | I/O size (minimum/ | ||
+ | Disklabel type: gpt | ||
+ | Disk identifier: EAA2F832-9810-AA45-9DDB-8ED531C20139 | ||
+ | |||
+ | Device | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** This shows the Type has been changed to **Linux RAID**. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Write the Partition Table ==== | ||
+ | |||
+ | <code bash> | ||
+ | Command (m for help): w | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | The partition table has been altered. | ||
+ | Calling ioctl() to re-read partition table. | ||
+ | Syncing disks.</ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Partition other Disks ===== | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE:** Repeat the above instructions for the other free disks. | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | ===== Check the available disks again ===== | ||
+ | |||
+ | <code bash> | ||
+ | lsblk | ||
+ | </ | ||
+ | |||
+ | returns: | ||
+ | |||
+ | <code bash> | ||
+ | NAME | ||
+ | sda 8:0 0 232.9G | ||
+ | ├─sda1 | ||
+ | ├─sda2 | ||
+ | ├─sda3 | ||
+ | ├─sda4 | ||
+ | sdb 8:32 | ||
+ | ├─sdb1 | ||
+ | sdc 8:48 | ||
+ | ├─sdc1 | ||
+ | sdd 8:64 | ||
+ | ├─sdd1 | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * At this point, these disks can be tied together as a RAID array. | ||
+ | </ | ||
+ | |||
nas/build_a_linux_nas/prepare_the_raid_disks.1632584980.txt.gz · Last modified: 2021/09/25 15:49 by peter