<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">I found the solution to my problem recycling my DRBD partition. Perusing the mount(8) source code, I discovered wipefs(8), which can read and clear the filesystem identifiers. After I use wipefs –a on my partition,
I can mkfs.ext4 and mount it as a regular (non-DRBD) filesystem just fine. <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I also discovered that mount –t ext4 will work as well (instead of mount without the –t).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">And for the record, I was wrong; the command that writes the identifier is create-md, not –overwrite-data-of-peer.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> drbd-user-bounces@lists.linbit.com [mailto:drbd-user-bounces@lists.linbit.com]
<b>On Behalf Of </b>Eric Ewanco<br>
<b>Sent:</b> Tuesday, June 17, 2014 4:09 PM<br>
<b>To:</b> drbd-user@lists.linbit.com<br>
<b>Subject:</b> [DRBD-user] Re-using DRBD partitions<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The steps I used to create the DRBD partition:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">drbdadm create-md r0<o:p></o:p></p>
<p class="MsoNormal">drbdadm up r0<o:p></o:p></p>
<p class="MsoNormal">drbdadm -- --overwrite-data-of-peer primary r0<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It’s the last step that seems to seal the fate; I’ve done lots of create-md’s alone with no problem.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">mount: unknown filesystem type 'drbd'<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I appreciate any help; thanks in advance.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Raw data, after recreating the partition table, repartitioning, and doing a mkfs.ext4 on each partition:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(none):/tmp # mount /dev/sda3 /mnt/media<o:p></o:p></p>
<p class="MsoNormal">mount: unknown filesystem type 'drbd'<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # dd if=/dev/zero of=/dev/sda3 bs=1M count=1<o:p></o:p></p>
<p class="MsoNormal">1+0 records in<o:p></o:p></p>
<p class="MsoNormal">1+0 records out<o:p></o:p></p>
<p class="MsoNormal">1048576 bytes (1.0 MB) copied, 0.084838 s, 12.4 MB/s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q -b 4096 /dev/sda3 1953211<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mount /dev/sda3 /mnt/media<o:p></o:p></p>
<p class="MsoNormal">mount: unknown filesystem type 'drbd'<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # dd if=/dev/zero of=/dev/sda bs=1k count=1<o:p></o:p></p>
<p class="MsoNormal">1+0 records in<o:p></o:p></p>
<p class="MsoNormal">1+0 records out<o:p></o:p></p>
<p class="MsoNormal">1024 bytes (1.0 kB) copied, 0.00182522 s, 561 kB/s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal /dev/sda mklabel msdos<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart primary 2048s 19337215s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q /dev/sda1<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart primary 19337216s 48633855s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q /dev/sda2<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart primary 48633856s 64260095s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q -b 4096 /dev/sda3 1953211<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart extended 64260096s -1<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 64262144s 126267391s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q /dev/sda5<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 126269440s 184862719s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q /dev/sda6<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 184864768s 243458047s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q /dev/sda7<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted -s -a optimal -- /dev/sda mkpart logical 243460096s 247463935s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q /dev/sda8<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mount /dev/sda3 /mnt/media<o:p></o:p></p>
<p class="MsoNormal">mount: unknown filesystem type 'drbd'<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # parted /dev/sda unit s print list<o:p></o:p></p>
<p class="MsoNormal">Model: ATA ATP IG SlimSATA (scsi)<o:p></o:p></p>
<p class="MsoNormal">Disk /dev/sda: 247463936s<o:p></o:p></p>
<p class="MsoNormal">Sector size (logical/physical): 512B/512B<o:p></o:p></p>
<p class="MsoNormal">Partition Table: msdos<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Number Start End Size Type File system Flags<o:p></o:p></p>
<p class="MsoNormal">1 2048s 19337215s 19335168s primary ext4 type=83<o:p></o:p></p>
<p class="MsoNormal">2 19337216s 48633855s 29296640s primary ext4 type=83<o:p></o:p></p>
<p class="MsoNormal">3 48633856s 64260095s 15626240s primary ext4 type=83<o:p></o:p></p>
<p class="MsoNormal">4 64260096s 247463935s 183203840s extended lba, type=0f<o:p></o:p></p>
<p class="MsoNormal">5 64262144s 126267391s 62005248s logical ext4 type=83<o:p></o:p></p>
<p class="MsoNormal">6 126269440s 184862719s 58593280s logical ext4 type=83<o:p></o:p></p>
<p class="MsoNormal">7 184864768s 243458047s 58593280s logical ext4 type=83<o:p></o:p></p>
<p class="MsoNormal">8 243460096s 247463935s 4003840s logical ext4 type=83<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(none):/tmp # dd if=/dev/zero of=/dev/sda3 bs=15626240 count=512<o:p></o:p></p>
<p class="MsoNormal">512+0 records in<o:p></o:p></p>
<p class="MsoNormal">512+0 records out<o:p></o:p></p>
<p class="MsoNormal">8000634880 bytes (8.0 GB) copied, 95.333 s, 83.9 MB/s<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mkfs.ext4 -q -b 4096 /dev/sda3 1953211<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp # mount /dev/sda3 /mnt/media<o:p></o:p></p>
<p class="MsoNormal">(none):/tmp #<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">drbd.conf:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">global {<o:p></o:p></p>
<p class="MsoNormal"> usage-count no;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">common {<o:p></o:p></p>
<p class="MsoNormal"> protocol C;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">resource r0 {<o:p></o:p></p>
<p class="MsoNormal"> on alice {<o:p></o:p></p>
<p class="MsoNormal"> device /dev/drbd1;<o:p></o:p></p>
<p class="MsoNormal"> disk /dev/sda3;<o:p></o:p></p>
<p class="MsoNormal"> meta-disk internal;<o:p></o:p></p>
<p class="MsoNormal"> address 10.250.1.3:7789;<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"> on bob {<o:p></o:p></p>
<p class="MsoNormal"> device /dev/drbd1;<o:p></o:p></p>
<p class="MsoNormal"> disk /dev/sda3;<o:p></o:p></p>
<p class="MsoNormal"> meta-disk internal;<o:p></o:p></p>
<p class="MsoNormal"> address 10.250.1.4:7789;<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Eric<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>