git: sbin/hammer: Add hammer strip command
Tomohiro Kusumi
tkusumi at crater.dragonflybsd.org
Mon Dec 5 10:00:56 PST 2016
commit 2eccaef52dab614a753aba8029714fe5424c26e1
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date: Sun Dec 4 18:57:15 2016 +0900
sbin/hammer: Add hammer strip command
This command is inspired by hammer recover command, and does
opposite of what recover command does.
This command zero clears zone-8(B-Tree) big-blocks, zone-9(meta)
big-blocks, and then the whole volume header, except that volume
signature field is overwritten with "STRIPPED" instead of zeros.
After running, a filesystem is no longer mountable or recoverable
with hammer recover command. This command is also fast as it only
zero clears good enough ondisk data to make it unmountable and
unrecoverable.
Keep in mind that this command does _not_ zero clear user data.
Users would normally use a software designed to completely shred
a filesystem. This command is not designed to shred a filesystem.
The name "strip" gives better idea of what it really does than
using "shred"/etc.
-- example
# newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null
# mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
# cd /HAMMER
# dd if=/dev/urandom of=./out bs=1M count=120000
120000+0 records in
120000+0 records out
125829120000 bytes transferred in 1766.417077 secs (71234094 bytes/sec)
# cd
# umount /HAMMER
# hammer -f /dev/da1:/dev/da2:/dev/da3 strip
You have requested that HAMMER filesystem (TEST) be stripped
Do you really want to do this? [y/n] y
Stripping HAMMER filesystem (TEST) in 5 4 3 2 1.. starting destruction pass
8000000021000000
9000000021800000
800000019c000000
800000030c000000
800000047e000000
80000005f7000000
8000000767000000
80000008d8000000
8000000a51800000
8000000bc5000000
8000000d37800000
8000000ead000000
800000101e800000
8000001193000000
8000001304000000
8000001478800000
80000015ee000000
8000001760800000
80000018d1800000
8000001a47000000
8000001bb6000000
801000013c000000
/dev/da1
/dev/da2
/dev/da3
# mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
mount: Invalid argument
mount_hammer: /dev/da1: Invalid volume signature 4445505049525453
Summary of changes:
sbin/hammer/Makefile | 3 +-
sbin/hammer/cmd_strip.c | 181 +++++++++++++++++++++++++++++++++++++++++
sbin/hammer/hammer.8 | 27 +++++-
sbin/hammer/hammer.c | 7 ++
sbin/hammer/hammer.h | 1 +
sys/vfs/hammer/hammer_ondisk.c | 4 +-
6 files changed, 219 insertions(+), 4 deletions(-)
create mode 100644 sbin/hammer/cmd_strip.c
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/2eccaef52dab614a753aba8029714fe5424c26e1
--
DragonFly BSD source repository
More information about the Commits
mailing list