[DRBD-user] Re-using DRBD partitions

Eric Ewanco Eric.Ewanco at genband.com
Tue Jun 17 22:08:40 CEST 2014

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


I'm using 8.3.11 (OpenSuSE 12.2) and I'm unable, without great effort, to re-purpose a partition once I've fully initialized it for DRBD.  Some data is sticking around that identifies the filesystem as type DRBD even after I repartition and do an mkfs on it, causing mount failures.  I've attempted to search the web for an answer to this but found nothing relevant.

The context of this is a home-grown installer.  Basically we'd like to be able to re-image and re-install a system regardless of how it's configured.  As it is, it fails if DRBD was fully configured on the target.

The steps I used to create the DRBD partition:

drbdadm create-md r0
drbdadm up r0
drbdadm -- --overwrite-data-of-peer primary r0

It's the last step that seems to seal the fate; I've done lots of create-md's alone with no problem.

When I create a new partition table, repartition the disk (same geometry), and do a mkfs.ext4 on each partition (foreshortened for the DRBD partition's internal metadata), and then attempt to mount the raw partition (as if it did not have DRBD installed), I get

mount: unknown filesystem type 'drbd'

But the partition software reports type 83 (ext4).  Where it is getting this "filesystem type" I'm not sure, given that the partition is marked as ext4 in the partition table and I did a mkfs.ext4 on it.

The only solution I've found is to zero out the entire partition, but this takes at least a minute if not several minutes.  I want a quicker way to do this.  Where is this filesystem type stored?  What am I missing?  I've tried zeroing out the first 1k of the disk, the first 1M of the partition, and the entire metadata, to no avail.

I appreciate any help; thanks in advance.

Raw data, after recreating the partition table, repartitioning, and doing a mkfs.ext4 on each partition:

(none):/tmp # mount /dev/sda3 /mnt/media
mount: unknown filesystem type 'drbd'
(none):/tmp # dd if=/dev/zero of=/dev/sda3 bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.084838 s, 12.4 MB/s
(none):/tmp # mkfs.ext4 -q -b 4096 /dev/sda3 1953211
(none):/tmp # mount /dev/sda3 /mnt/media
mount: unknown filesystem type 'drbd'
(none):/tmp # dd if=/dev/zero of=/dev/sda bs=1k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.00182522 s, 561 kB/s
(none):/tmp # parted -s -a optimal /dev/sda mklabel msdos
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart primary 2048s 19337215s
(none):/tmp # mkfs.ext4 -q /dev/sda1
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart primary 19337216s 48633855s
(none):/tmp # mkfs.ext4 -q /dev/sda2
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart primary 48633856s 64260095s
(none):/tmp # mkfs.ext4 -q -b 4096 /dev/sda3 1953211
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart extended 64260096s -1
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 64262144s 126267391s
(none):/tmp # mkfs.ext4 -q /dev/sda5
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 126269440s 184862719s
(none):/tmp # mkfs.ext4 -q /dev/sda6
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 184864768s 243458047s
(none):/tmp # mkfs.ext4 -q /dev/sda7
(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 243460096s 247463935s
(none):/tmp # mkfs.ext4 -q /dev/sda8
(none):/tmp # mount /dev/sda3 /mnt/media
mount: unknown filesystem type 'drbd'
(none):/tmp # parted /dev/sda unit s print list
Model: ATA ATP IG SlimSATA (scsi)
Disk /dev/sda: 247463936s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system  Flags
1      2048s       19337215s   19335168s   primary   ext4         type=83
2      19337216s   48633855s   29296640s   primary   ext4         type=83
3      48633856s   64260095s   15626240s   primary   ext4         type=83
4      64260096s   247463935s  183203840s  extended               lba, type=0f
5      64262144s   126267391s  62005248s   logical   ext4         type=83
6      126269440s  184862719s  58593280s   logical   ext4         type=83
7      184864768s  243458047s  58593280s   logical   ext4         type=83
8      243460096s  247463935s  4003840s    logical   ext4         type=83

(none):/tmp # dd if=/dev/zero of=/dev/sda3 bs=15626240 count=512
512+0 records in
512+0 records out
8000634880 bytes (8.0 GB) copied, 95.333 s, 83.9 MB/s
(none):/tmp # mkfs.ext4 -q -b 4096 /dev/sda3 1953211
(none):/tmp # mount /dev/sda3 /mnt/media
(none):/tmp #

drbd.conf:

global {
  usage-count no;
}
common {
  protocol C;
}
resource r0 {
  on alice {
    device    /dev/drbd1;
    disk      /dev/sda3;
    meta-disk internal;
    address   10.250.1.3:7789;
  }
  on bob {
    device    /dev/drbd1;
    disk      /dev/sda3;
    meta-disk internal;
    address   10.250.1.4:7789;
  }
}

Eric



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20140617/741a65b6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Eric J Ewanco.vcf
Type: text/x-vcard
Size: 3815 bytes
Desc: Eric J Ewanco.vcf
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20140617/741a65b6/attachment.vcf>


More information about the drbd-user mailing list