Skip to contentSkip to conversation

Any chance to recovery btrfs raid-0 after accidental format of one volume?

DISCUSSION Tomasz Chmielewski 1 participant 1 message Sep 6, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines

Bad case of user error here but I managed to reformat one half of a btrfs volume that was set up with metadata raid-1 and data raid-0.

It won't help you - but did you format it with mkfs.btrfs, while it was mounted?

mkfs.btrfs behaves very dangerously here.

For example, we have a block device in use:

# cat /proc/swaps 
Filename				Type		Size	Used	Priority
/dev/md0                                partition	10233276	0	-1

mkfs for other filesystems will refuse to touch it, because it's in use:

# mkfs.ext4 /dev/md0
mke2fs 1.41.14 (22-Dec-2010)
/dev/md0 is mounted; will not make a filesystem here!
# mkfs.xfs /dev/md0
mkfs.xfs: cannot open /dev/md0: Device or resource busy

mkfs.btrfs doesn't see a problem in creating a filesystem on a mounted block device:

# mkfs.btrfs /dev/md0

WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using

fs created label (null) on /dev/md0

	nodesize 4096 leafsize 4096 sectorsize 4096 size 9.76GB

Btrfs Btrfs v0.19

Signature · 2 lines
Tomasz Chmielewski
http://wpkg.org