0

I'm trying to create (two) software RAID1 arrays on two identical 4TB non-boot drives. I'm following advice from several forum posts but keep running into trouble. Here's what I've done so far:

  • for each brand-new drive (/dev/sdb and /dev/sdc):

    • sudo fdisk <drive>

    • "o" to create a new partition table (I think this is necessary?)

    • "n" to create new partition

    • "p" and "1" to create primary partition #1

    • "2048" (default) partition start

    • "+3500M" partition end at 3.5GB.

    • Repeat with "p", "2", , "+500M" to create a smaller 500MB partition

    • This creates /dev/sdb1, /dev/sdb2, /dev/sdc1, /dev/sdc2

  • Create raid arrays: sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

    • Repeat with /dev/md0, /dev/sdb2, /dev/sdc2
  • Create file system: sudo mkfs -t ext4 /dev/md0

Creating the file system results in no errors, but if I run sudo fdisk -l /dev/md0 I get:

Disk /dev/md0: 3667 MB, 3667853312 bytes
2 heads, 4 sectors/track, 895472 cylinders, total 7163776 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

I can't seem to fix the "doesn't contain a valid partition table" thing. Is this a problem or is it supposed to be this way?

Bonus question: assuming I get these two arrays working, what is the "standard" place to mount them? Root?

1
  • IMHO your problems emanate from the use of fdisk when you should be using gdisk. Fdisk works with Master Boot Records (MBRs) which are limited to 2TB. For larger disks you will need to create a GUID Partion Table (GPT) which is done through the use of gdisk Please see this post for reference and how to: askubuntu.com/questions/350266/…
    – Yossi
    Feb 13, 2018 at 20:09

1 Answer 1

0

Since you did not create a partition table, and only a partition, yes, it is supposed to be this way.

Example:

$ dd if=/dev/zero of=/tmp/file bs=4096 count=$((1024*1024 / 4096))
$ mkfs -t ext4 /tmp/file
mke2fs 1.42.9 (4-Feb-2014)
/tmp/file is not a block special device.
Proceed anyway? (y,n) y
$ fdisk -l !$
fdisk -l /tmp/file

Disk /tmp/file: 1 MB, 1048576 bytes
255 heads, 63 sectors/track, 0 cylinders, total 2048 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /tmp/file doesn't contain a valid partition table

To make a partition table, you use something like:

parted /dev/md0 mklabel msdos

With fdisk:

$ fdisk /tmp/file
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xb1f4c1d2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
You must set cylinders.
You can do this from the extra functions menu.

Command (m for help): w

Simply opening it with fdisk makes it create a partition table. Use w to save it. You'll need to create a new partition within it.

You probably don't need it if the entire device is going to one partition.

2
  • Thanks for the help. Shouldn't I have had a partition table then since I created the partitions with fdisk? Or do I need to hit w and nothing else and then run it again? Still a bit confused. Anyways I ended up using parted instead, after finding out fdisk has problems with partition sizes over 2TB. I created a GPT partition table first, then added my partitions (manually entered the start of the first partition at 2048 blocks, and the division between them at -500GiB, don't think there should be alignment issues).
    – JaredL
    Sep 20, 2014 at 18:36
  • @Jumpy89 you created partitions on the underlying devices, not in the RAID device itself (for which you only used mkfs). When you open a device without a partition table in fdisk, it attempts to create one. That's when you use w.
    – muru
    Sep 20, 2014 at 18:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .