Re: [PATCH] xfs_mkfs: wipe old signatures from the device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx

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


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux