Mdraid: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
Tgurr (talk | contribs)
No edit summary
Line 12: Line 12:
{{Root|gdisk /dev/sdb}}
{{Root|gdisk /dev/sdb}}


We leave 100M of free space on the end of the device, just to be on the safe side if we have to replace a drive and won't be able to get an identical one which has the exact same amount of sectors.


{{Code|gdisk commands|
{{Code|gdisk commands|
Line 22: Line 23:
1
1
enter
enter
enter
-100M
fd00
fd00



Revision as of 02:32, 14 November 2013

Prepare the hard drives

In this example we create a RAID just for storage, so we only have one Partition on each drive.

Code: GPT partition layout for RAID
/dev/sdb	2.7 TiB	FD00	Linux RAID
/dev/sdc	2.7 TiB	FD00	Linux RAID
# gdisk /dev/sdb

We leave 100M of free space on the end of the device, just to be on the safe side if we have to replace a drive and won't be able to get an identical one which has the exact same amount of sectors.

Code: gdisk commands
Command (? for help): p
Disk /dev/sdb: 5860533168 sectors, 2.7 TiB
[...]

n
1
enter
-100M
fd00

p
w
Y


Create the RAID array

RAID 1

# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

RAID 5

# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sd[b-d]1

Checking the progress

# cat /proc/mdstat
# mdadm --detail /dev/md0
# mdadm --examine /dev/sdb1

fstab

Code: /etc/fstab
UUID=b036ad79-939f-d4ae-e2c0-2f3f5c2e7087	/mnt/raid	ext4	defaults,noatime