Personal tools
You are here: Home Linux I/O Using parted to create a RAID primary partition
 

Using parted to create a RAID primary partition

Instead of using a whole device for linux software RAID, use a partitioned device which mean the device has an easily read 'label'.  This means I can determine that it is a RAID member disk (as a against a standalone disk) just by looking at the partition table. However it can introduce alignment issues, which are mitigated by starting the partion at offset 1MB.

Steps

Run parted as root to create a partition table and raid partition.

# parted -a optimal /dev/sdf

Create a legacy master boot record (MBR) partition table

(parted) mklabel msdos 

Create a partition that is optimally alligned starts at 1MB into the disk (2048 sectors) and ends at the end of the disk (-1).

(parted) mkpart
Partition type?  primary/extended? primary
File system type?  [ext2]?
Start? 2048s
End? -1

Mark the partition as a software raid partition

(parted) set 1 raid on

Verify the partition is aligned

(parted) align-check
alignment type(min/opt)  [optimal]/minimal? optimal
Partition number? 1
1 aligned

Show the device

(parted) print
Model: ATA WDC WD3202ABYS-0 (scsi)
Disk /dev/sdf: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  320GB  320GB  primary               raid

Add the device to the Linux software RAID volume:

# mdadm --add /dev/md1 /dev/sdf1

Links

 

 

Document Actions