I have a micro SD card (/dev/mmcblk0) with one partition on it (/dev/mmcblk0p1).
There is a btrfs filesystem on it, that won't mount. When I insert it, I get an error message on the desktop, saying:
Error mounting /dev/mmcblk0p1 at /media/franck/mysdcard: Command-line `mount -t "btrfs" -o "uhelper=udisks2,nodev,nosuid" "/dev/mmcblk0p1" "/media/franck/mysdcard"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/mmcblk0p1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
So I want to erase the disk, re-partition it and reformat to a new fs (probably ext4).
My problem is that I cannot do it. fdisk as well as gparted try to do it, and then fail to read again the partition table:
$ sudo parted /dev/mmcblk0
GNU Parted 2.3
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: SD SD64G (sd/mmc)
Disk /dev/mmcblk0: 63.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 16.8MB 62.4GB 62.4GB primary btrfs
(parted) rm 1
(parted) print
Error: /dev/mmcblk0: unrecognised disk label
If I remove and re-insert the device, the old partition and fs are still here.
I suspect gvfs is holding a lock on the device, preventing any write on it:
$ sudo lsof /dev/mmcblk0
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
So, is there a way to erase my disk ?
Just zero out the drive and create a new partition table.
Zeroing the Drive:
To create a new parition table, simply use GParted or a similar tool.