All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: sandeen@redhat.com, kzak@redhat.com, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs_mkfs: wipe old signatures from the device
Date: Wed, 13 Feb 2013 07:27:53 +1100	[thread overview]
Message-ID: <20130212202753.GC26694@dastard> (raw)
In-Reply-To: <1360667215-14701-1-git-send-email-lczerner@redhat.com>

On Tue, Feb 12, 2013 at 12:06:55PM +0100, Lukas Czerner wrote:
> We should wipe off all the signatures from the device prior the file
> system creation. It is because because some file systems (btrfs) may
> still have their signatures on the device which can be confusing for
> userspace possibly resulting in the unmountable file system.
> 
> This patch adds a function which uses libblkid library to wipe all the
> signatures from the device.
> 
> If user disables libblkid library or does not have it installed this new
> feature will not be used. This case can be implemented separately.

mkfs.xfs already zeros the first part of the block device regardless
of whether it is using libblkid or not:

....
/* amount (in bytes) we zero at the beginning and end of the device to
 * remove traces of other filesystems, raid superblocks, etc.
 */
#define WHACK_SIZE (128 * 1024)
....

        /*
         * Zero out the beginning of the device, to obliterate any old
         * filesystem signatures out there.  This should take care of
         * swap (somewhere around the page size), jfs (32k),
         * ext[2,3] and reiserfs (64k) - and hopefully all else.
         */
        mp->m_ddev_targ.dev = xi.ddev;
        mp->m_ddev_targ.bt_mount = mp;
        buf = libxfs_getbuf(mp->m_ddev_targ, 0, BTOBB(WHACK_SIZE));
        memset(XFS_BUF_PTR(buf), 0, WHACK_SIZE);
        libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
        libxfs_purgebuf(buf);

Isn't 128k of zeroing enough to kill existing filesystem signatures?
If not how much is, and why can't we just change WHACK_SIZE to
reflect the size that will kill those signatures that are further
offset into the device?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2013-02-12 20:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 11:06 [PATCH] xfs_mkfs: wipe old signatures from the device Lukas Czerner
2013-02-12 11:31 ` Karel Zak
2013-02-12 11:58   ` Lukáš Czerner
2013-02-12 20:27 ` Dave Chinner [this message]
2013-02-13  8:01   ` Karel Zak
2013-02-13 10:41     ` Lukáš Czerner
2013-02-13 12:16       ` Karel Zak
2013-02-13 12:16         ` Karel Zak
2013-02-13 22:17         ` Dave Chinner
2013-02-13 22:17           ` Dave Chinner
2013-02-14  7:29           ` Chris Murphy
2013-02-14  7:29             ` Chris Murphy
2013-02-14  8:36             ` Lukáš Czerner
2013-02-14 11:04               ` Dave Chinner
2013-02-14 11:04                 ` Dave Chinner
2013-02-14 12:28                 ` Lukáš Czerner
2013-02-14 14:48                 ` Martin Steigerwald
2013-02-14 14:48                   ` Martin Steigerwald
2013-02-14 18:35                   ` Eric Sandeen
2013-02-14 18:35                     ` Eric Sandeen
2013-02-14 14:54                 ` Hugo Mills
2013-02-14 14:54                   ` Hugo Mills
2013-02-14 17:25               ` Eric Sandeen
2013-02-14 17:25                 ` Eric Sandeen
2013-02-14 19:08                 ` Chris Murphy
2013-02-14 11:45           ` Dave Howorth
2013-02-14 19:17             ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130212202753.GC26694@dastard \
    --to=david@fromorbit.com \
    --cc=kzak@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.