Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
(parted)
  • 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
add comment

1 Answer 1

up vote 1 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

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

To sum the answers up:

After the above steps. How do I create the partition and set any necessary flags?

See above!

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 at 5:21
add comment

Your Answer

 
discard

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.