# RAID-1 for non-system partitions?

## don quixada

Hi, I have a question, I'm about to create a RAID-1 array for my data partitions only and not the system partitions (which are on a SSD). There are lots of tutorials on setting up a RAID-1 system but they all assume that it is the whole system being RAIDed. So there is lots of talk about setting up swap and grub and /boot etc. Is it even possible to just set-up RAID-1 for only a few non-system partitions? An opinion or some direction would be appreciated. Maybe this is a silly question once I actually get into it but I wanted to know up front if I need to re-think my strategy. Thank you.

dq

----------

## NeddySeagoon

don quixada,

Just make raid1 for the filesystems you want on raid1 and add them to fstab in the normal way.

The raid set(s) will need to be started as part of the boot process, so you will need mdadm in the boot runlevel. You will also need a /etc/mdadm.conf to describe the raid sets to mdadm.

I'm assuming you don't want to assemble the raid sets in an initrd?

You can but its not needed and you will not use kernel auto assembly.

If you really want kernel raid autoassembly, you must use raid superblock version 0.90 and mark the partitions as type 0xfd.

Note that auto assembly has been depreciated for a long time now.

----------

## don quixada

Nice! looks simple enough although clearly I need to read more on this because I'm not sure what some of the things you mention are... I will try some stuff and report my results...

dq

----------

## don quixada

I received an error when I created the array:

```
# mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sd[ab]1

/dev/md1 alignment is offset by 512 bytes
```

It did it for all the partitions I created.

How do I fix? Is this an issue for RAID-1? I noticed on sites that people said that for RAID-1 is doesn't matter but if there is any slowdown at all I may as well fix it from the start...

Also, I can't seem to mount an ext4 partition. Does ext4 work with RAID systems?

Thanks.

dq

----------

## NeddySeagoon

don quixada,

It matters a great deal.

The system has detected that you have drives with 4kbyte physical sectors and that your partitions are not aligned on 4k boundaries.

It worlks but its very slow as the drive has to do read/modify/writes to cope with the misalignment.

Some suggestions show that there is a factor of 30x speed loss.

It sounds like you used a old version of fdisk, that put your first partition at sector 63, which while traditonal, is not what you want at all.

Remake your partitions, with either parted or an up to date fdisk, since they will get the alignment correct for you.

Check that the start sector is a multiple of 4k bytes.  If you display the partition table in sectors, all the start sectors must be exactly divisible by 8.

Remake your partitions and your raid sets.

----------

## don quixada

I used cfdisk, is that no good? I've always used that one. Also, I used all primary partitions (four in total). Should I switch to logical?

dq

----------

## NeddySeagoon

don quixada,

I don't knoow cfdisk.

What matters is the partition start sectors, not the tool you use.  If your first partition starts at sector 63, you need to fix it somehow.

It doesn't matter if you use logical or primary partitions.

----------

## don quixada

Ok, it seemed to work when I used fdisk although I'm not used to thinking in terms of sectors. I couldn't find anywhere in the Gentoo documentation on how to stop the array so I could re-partition but a quick search on the web showed me 'mdadm -S /dev/mdX' will stop the corresponding RAID-1 partition. I'll report any other strange happenings or problems.... Thank you for your help!

dq

----------

