After having a corrupted file system on my SD card due (probably due to unsufficient power supply) I want to make a new filesystem. (e2fsck
fails, log below.)
However, any file-related changes on the SD card are magically undone!
- First example: when I mount the SD card, delete some files, the files disappear. When I unmount it and mount it again, the files are there again! Similarly when I modify a file's content, the original content is back after re-mount.
- Second example: when I create a new partition table with
fdisk
, the old partition table is back in place immediately. (Log below.) - Third example: while I run
dd if=/dev/zero of=/dev/mmcblk0 bs=1M
,fdisk
reasonably saidDisk /dev/mmcblk0 doesn't contain a valid partition table
. Whendd
was done, the old partition table was back again.
I have not locked the SD card physically with the small switch. I don't get any read-only errors. In fact, I don't get any errors at all! dmesg
doesn't report anything except that I'm mounting a file system with errors.
The problem also occurred running a Xubuntu live cd (12.10). Unfortunately I don't have access to other computers and/or SD card readers at the moment.
Is that a problem of my computer, my SD card, or am I missing something all the time? Any suggestions what I could try?
e2fsck
fails:
$ sudo e2fsck /dev/mmcblk0p2
e2fsck 1.42.5 (29-Jul-2012)
/dev/mmcblk0p2: recovering journal
Superblock needs_recovery flag is clear, but journal has data.
Run journal anyway<y>? yes
e2fsck: unable to set superblock flags on /dev/mmcblk0p2
/dev/mmcblk0p2: ********** WARNING: Filesystem still has errors **********
Here's the log that shows that fdisk
has no effect:
$ sudo fdisk /dev/mmcblk0
Command (m for help): p
Disk /dev/mmcblk0: 31.5 GB, 31460425728 bytes
4 heads, 16 sectors/track, 960096 cylinders, total 61446144 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00017b69
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 61446143 30661632 83 Linux
Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Selected partition 2
Command (m for help): p
Disk /dev/mmcblk0: 31.5 GB, 31460425728 bytes
4 heads, 16 sectors/track, 960096 cylinders, total 61446144 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00017b69
Device Boot Start End Blocks Id System
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 31.5 GB, 31460425728 bytes
4 heads, 16 sectors/track, 960096 cylinders, total 61446144 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00017b69
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 61446143 30661632 83 Linux