Do not create manual Raid-5 by mdadm
Use the Proxmox GUI: Node > Disks > ZFS
The RaidZ is the Raid-5, the RaidZ2 is the Raid-6
Assuming you have additional 3 HDDs like sdb, sdc, sdd, and willing to setup a Raid-5 like redundancy.
First, clean the HDDs:
sgdisk --zap-all /dev/sdb
sgdisk --zap-all /dev/sdc
sgdisk --zap-all /dev/sdd
Then create ZFS pool: Use the Proxmox GUI: Node > Disks > ZFS
Or, by command:
#zpool create -f -o ashift=12 raid5 raidz1 <device1> <device2> <device3>
zpool create -f -o ashift=12 raid5 raidz /dev/sdb /dev/sdc /dev/sdd
Whenever a Disk failer occur:
Changing a failed device:
# zpool replace -f raidz <old-device> <new-device>
Included ZFS system in Proxmox is better to use !
<! ------------------------------------------------------------- !>
Or else, you can proceed to manual setup Raid-5:
Creating a RAID-5 on your additional drives with Proxmox 8 involves a few key steps.
Raid-5 benefit is, it will eat your only one HDD, so if you use 3 HDD to create Raid-5 then you will get 2 HDD's space.
Remember ! In a first time Raid setup, clean the Raid metadata from HDDs first.
Clear RAID Metadata on All Drives
mdadm --zero-superblock /dev/sdb
mdadm --zero-superblock /dev/sdc
mdadm --zero-superblock /dev/sdd
Now, start building the Raid-5
1) Step 1: Install "mdadm" Raid Software
apt install mdadm
2) Step 2: Check the Drives
lsblk
The output should show your Primary Disk, and the three additional HDDs. The HDDs will likely be named /dev/sdb, /dev/sdc, and /dev/sdd (but verify this by checking the size).
3) Step 3: Create the RAID-5 Array
mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
It may take some time to built, you can check status by:
cat /proc/mdstat
4) Step 4: Create a Filesystem
mkfs.ext4 /dev/md0
5) Step 5: Mount the RAID Array
mkdir /mnt/raid
mount /dev/md0 /mnt/raid
6) Step 6: Make the RAID Array Mount Permanent
Get the UUID of the RAID array:
blkid /dev/md0
Copy the UUID and add it to /etc/fstab. Open the file:
nano /etc/fstab
Add the following line at the end of the file:
UUID=<your-raid-uuid> /mnt/raid ext4 defaults 0 2
7) Step 7: Save the RAID Configuration
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
This ensures that if the server is rebooted, the RAID array is correctly reassembled.
8) Step 8: Verify Everything is Set Up
cat /proc/mdstat
df -h
Finally, your Raid-5 is done !
################################
If any of your one disk get fault, you can replace that disk and rebuild the RAID array:
Step 1: Identify the Failed Drive
cat /proc/mdstat
The output will show the status of the RAID and whether any drive is marked as "failed", you will see the failed drive marked as (F)
If you want to see detail, run: mdadm --detail /dev/md0
Step 2: Remove the Failed Disk from the RAID Array
Assuming the failed disk is /dev/sdc:
mdadm /dev/md0 --remove /dev/sdc
Step 3: Physically Replace the Failed Disk
Now, you can physically replace the failed disk with a new one. Once the new disk is installed and detected by the system, you can proceed to add it back to the RAID array.
Step 4: Add the New Disk to the RAID Array
Once the new disk is available (you can check it with lsblk or fdisk), add it to the RAID array. Assuming the new disk is /dev/sde:
mdadm /dev/md0 --add /dev/sde
Step 5: Rebuild the RAID Array
After adding the new disk, the RAID array will start rebuilding automatically. You can monitor the rebuild process by running:
cat /proc/mdstat
This will show the rebuild progress. Depending on the size of the disk and the amount of data, this may take some time. Make sure you don’t interrupt the process to avoid data corruption.
Step 6: Verify the Rebuild Completion
Once the rebuild is complete, the RAID array will return to a healthy state. The output of cat /proc/mdstat should indicate that the RAID is now fully synchronized and all drives are operational.
You can check the detail by:
mdadm --detail /dev/md0
Step 7: Update the RAID Configuration
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
This ensures that if the server is rebooted, the RAID array is correctly reassembled.
Post a Comment
Post a Comment