Skip to content

Instantly share code, notes, and snippets.

@GermanAizek
Last active November 22, 2024 00:24
Show Gist options
  • Save GermanAizek/3fd2ab06afc69f1102abb5cab3f50061 to your computer and use it in GitHub Desktop.
Save GermanAizek/3fd2ab06afc69f1102abb5cab3f50061 to your computer and use it in GitHub Desktop.
MDADM create RAID 10 and copy from old disk/partition

The Publisher:

Collective Ink Ltd, Laurel House, Station Approach, Alresford, Hampshire, SO24 9JH, United Kingdom

The Licensee:

Herman Semenov <[email protected]> (Foreign Publisher and address)

Street: Terschellingsestraat 64

City: Rotterdam

State/province/area: Zuid-Holland

Zip code: 3083 PH

Adding new disk/partition to RAID 10

We need to add the new partition to mdadm to create RAID 10, format it with ext4

mdadm --create /dev/md0 --level raid10 --name raid10 --raid-disks 4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
# type y to continue

after create md0, we need to format with ext4

mkfs.ext4 /dev/md0

use lsblk -f to check partitions and FSTYPE

Copy data from old disk/partition to new disk/partition

We need to copy old data from old partition ext4 /dev/sda2 to new partition /dev/md0, first create two folders to mount the two partitions and then clone data with rsync or cp...

cd /mnt

go to path /mnt, I prefer this path because we are going to mount /mnt, you can create it wherever you want, and mount it

mkdir md0 var
mount /dev/md0 md0
mount /dev/sda2 var

Before this command check very well before, because it has attribute -delete, it deletes files in the destination /md0 that are not found in the source /var check "Copy entire file system hierarchy from one drive to another" and "rsync how to do a checksum on rsync" links

rsync -axcHAWXS -delete --numeric-ids --info=progress2 var/ md0/

And GRUB install in RAID10 array using command:

grub-install /dev/md0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment