xfs
[Top] [All Lists]

REVIEW: zero existing secondary superblocks with mkfs.xfs -f

To: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>, xfs-dev <xfs-dev@xxxxxxx>
Subject: REVIEW: zero existing secondary superblocks with mkfs.xfs -f
From: "Barry Naujok" <bnaujok@xxxxxxx>
Date: Wed, 11 Jul 2007 19:07:24 +1000
Organization: SGI
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Opera Mail/9.10 (Win32)
The attached patch zeros all the secondary superblocks if
overwriting an existing XFS filesystem.

This allows xfs_repair to detect the correct secondary block
if the primary is destroyed (like XFS QA test 030).

To demonstrate the bad behaviour, try the following:

# mkfs.xfs -f /dev/xxx
... [note agcount reported]
# dd if=/dev/zero of=/dev/xxx oflag=direct bs=512 count=1
# xfs_repair /dev/xxx
...
(it should recover and a second repair will succeed.)
# mkfs.xfs -f -d agcount=<smaller than above> /dev/xxx
...
# dd if=/dev/zero of=/dev/xxx oflag=direct bs=512 count=1
# xfs_repair /dev/xxx

It will either die or succeed (in my test, xfs_repair
actually crashed because it doesn't handle bad extents yet!).

If success, try and mount it and run:
# xfs_info /dev/xxx
(It should be the geometry of the first mkfs run.)

Try the patch and repeat - success.

Attachment: mkfs_zero_old_ags.patch
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>