Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 154405

Summary: mkswap should clear key parts of the block device
Product: [Fedora] Fedora Reporter: David Zeuthen <davidz>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: mclasen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-17 15:46:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description David Zeuthen 2005-04-11 15:08:36 UTC
Description of problem:

The first 512 bytes of a block device formatted with mkswap are not cleared;
this means that filesystems probers may errornously detect a swap partition as a
vfat partition, mount it and then data corruption may happen.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:

Kay Sievers <> made a test program that creates a loop
device and formats, cross-formats and probes it with volume_id if the fs is
recognized. For now only: swap, fat, ext2, ext3 are cross-tested and it finds
only one error. 

1. Download
2. Unpack archive
3. make
4. as root run ./ from with the vid directory of the archive
Actual results:

mkswap should clear parts of the block device where other OS'es expects to find
file system signatures. For most practical situations this is clearing at least
the first 2048 bytes.

Expected results:

Additional info:

Comment 3 Karel Zak 2005-09-30 15:56:28 UTC
BTW, there's libblkid (from e2fsprogs package) that does same work as the "vid"
code. The best solution will be use same code in all our packages rather than
duplicate funcionality. The libblkid is really good designed and doesn't have a
problem with swap detection :-)

Comment 4 Karel Zak 2005-10-17 15:46:27 UTC
That's feature that mkswap doesn't touch the first block of swap area.

man mkswap:

The new style header does not touch the first block, so may be preferable, in
case you have a boot loader or disk label there.

Sorry. CLOSING...