Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For testing I want to create a mirrored (RAID 1) partition with a size of 1GB on /dev/sdb and /dev/sdc. When it comes to partitioning, I want to used parted, how should I create the partition I want to mirror?

I start by initializing the partition table:

(parted) select /dev/sdb
Using /dev/sdb
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Y
  • After the above steps. How do I create the partition and set any necessary flags?

  • I know that raid is a possible partition flag, do I have to use it? How is it used by the running system?

  • Which file system type should I use? None?

share|improve this question
The flag is used by the kernel (Linux) to indicate RAID partitions it should mount. That's not all of the answer I was looking for, so I write it here for now. – Deleted Oct 15 '12 at 3:46
up vote 2 down vote accepted

Start Parted using -a optimal to make sure it warns you in case you are creating a partition which is not correctly aligned. Create the partition without specifying any file system using mkpart:

mkpart primary 1MiB 512MiB

This command creates a 511MiB partition starting at 1MiB and ending at 512MiB.

Use MiB, GiB or TiB when creating the partition. This ensures correct alignment on HDD's with 512B as well as 4096B physical sectors.

Above 1MiB is used as the starting position, as it's the lowest position you can use without Parted complaining about alignment. But make a mental note that sector 40 really is the lowest position with correct alignment, but parted likes 1MiB boundaries and you're wasting very little disk space.

To make the kernel notice the RAID partition and mount it automatically you need to set the raid flag. If your new partition is identified as partition 1 in Parted (check with p) you set the raid flag using:

set 1 raid on

Verify the partitions sizes with print, but set unit display to KiB, MiB, or GiB. If you do not, the default compact units will show KB, MB and GB.

unit MiB

To sum the answers up:

I know that raid is a possible partition flag, do I have to use it? How is it used by the running system?

No you don't have to. In case you choose not to you have to mount it yourself.

Which file system type should I use? None?

Yes, don't specify one. Parted is moving away from handling file systems, the stuff relating to filesystems at the moment should be avoided.

share|improve this answer
Does it make sense to create 2 partitions on a single hard disk and then using the 2 partitions for RAID 1 or RAID 0? Or is RAID meant to be only be used with real independent hard disks? – CMCDragonkai Jun 19 '14 at 5:21
@CMCDragonkai: Using the same disk for multiple members of the same array makes no sense. If the disk dies, you most likely lose access to the whole disk, not just a part of it. But nothing stops you from doing it anyway. You could even use loop devices if you just want to test stuff... – ThiefMaster Dec 3 '14 at 21:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.