[DRBD-user] Re-using DRBD partitions

Eric Ewanco Eric.Ewanco at genband.com
Wed Jun 18 14:43:42 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.

Thanks for the reply.  At the point I’m at, I’m not interested in using sda3 anymore as a DRBD partition, I’m interested in destroying and re-creating it as a normal ext4 filesystem that can be used without DRBD.  Basically, I want to entirely uninstall DRBD from the disk and start from scratch, but something DRBD-related has its tentacles in the disk preventing me from using it as a normal filesystem.  At this stage, I’m running an installer in a single-user limited environment and DRBD is not running, and there is no other node.  So there is no /dev/drbd1.

From: Rabin Yasharzadehe [mailto:rabin at isoc.org.il]
Sent: Wednesday, June 18, 2014 2:33 AM
To: Eric Ewanco
Cc: drbd-user at lists.linbit.com
Subject: Re: [DRBD-user] Re-using DRBD partitions

TL;DR (based on the raw input)

I think you're using it wrong,
after applying the DRBD layer over sda3, you can't use sda3 anymore (actually you can, but do not do it)
your new device is /dev/drbd1 and this is the new block device you spouse to partition and use.
when you access sda3 directly, the drbd driver can't see the write access to the block device, and because of that it will not sync the changes to the other node.


On Tue, Jun 17, 2014 at 11:08 PM, Eric Ewanco <Eric.Ewanco at genband.com<mailto:Eric.Ewanco at genband.com>> wrote:
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 #


global {
  usage-count no;
common {
  protocol C;
resource r0 {
  on alice {
    device    /dev/drbd1;
    disk      /dev/sda3;
    meta-disk internal;
  on bob {
    device    /dev/drbd1;
    disk      /dev/sda3;
    meta-disk internal;


drbd-user mailing list
drbd-user at lists.linbit.com<mailto:drbd-user at lists.linbit.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20140618/433c7ea1/attachment.htm>

More information about the drbd-user mailing list