I have an SD card which was used in Raspberry Pi. I want to mount this SD card on a Linux PC to get files from it, but I can't.
When I put the SD card in a card reader, my dmesg says:
[ 114.117896] usb 4-1: new full-speed USB device number 2 using ohci-pci [ 114.292885] usb 4-1: New USB device found, idVendor=214b, idProduct=1101 [ 114.292897] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 114.292904] usb 4-1: Product: USB2.0 Device [ 114.292910] usb 4-1: Manufacturer: Generic [ 114.292914] usb 4-1: SerialNumber: 0201202010201000 [ 114.383603] usb-storage 4-1:1.0: USB Mass Storage device detected [ 114.383803] scsi6 : usb-storage 4-1:1.0 [ 114.383956] usbcore: registered new interface driver usb-storage [ 115.386965] scsi 6:0:0:0: Direct-Access USB2.0 CARD-READER 1.01 PQ: 0 ANSI: 2 [ 115.388961] sd 6:0:0:0: Attached scsi generic sg2 type 0 [ 115.409892] sd 6:0:0:0: [sdc] Attached SCSI removable disk [ 115.471798] sd 6:0:0:0: [sdc] 30679040 512-byte logical blocks: (15.7 GB/14.6 GiB) [ 115.505782] sdc: detected capacity change from 0 to 15707668480 [ 115.534776] sdc: sdc1 sdc2 < sdc5 sdc6 > sdc3
The partition table of this card is:
# parted /dev/sdc GNU Parted 3.2 Using /dev/sdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: USB2.0 CARD-READER (scsi) Disk /dev/sdc: 15,7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 1275MB 1274MB primary fat32 lba 2 1278MB 15,7GB 14,4GB extended 5 1279MB 1342MB 62,9MB logical fat16 lba 6 1343MB 15,7GB 14,3GB logical 3 15,7GB 15,7GB 33,6MB primary
When I check this device with fdisk, it says:
# fdisk /dev/sdc -l Disk /dev/sdc: 14.6 GiB, 15707668480 bytes, 30679040 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 Disklabel type: dos Disk identifier: 0x000daf86 Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 2490234 2488187 1.2G e W95 FAT16 (LBA) /dev/sdc2 2496512 30609407 28112896 13.4G 85 Linux extended /dev/sdc3 30613504 30679039 65536 32M 83 Linux /dev/sdc5 2498560 2621439 122880 60M c W95 FAT32 (LBA) /dev/sdc6 2623488 30607359 27983872 13.4G 83 Linux Partition table entries are not in disk order.
It seems that /dev/sdc6 is the biggest partition, so I want to mount it. When I try to mount it, I get this result:
# mount -v /dev/sdc6 test mount: wrong fs type, bad option, bad superblock on /dev/sdc6, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.
Dmesg doesn't say anything when I try to mount /dev/sdc6.
When I check this partition with file command, it says:
# file -s /dev/sdc6 /dev/sdc6: data
When I check the filesystem with fsck, I get:
# LC_ALL=C fsck.ext3 -n /dev/sdc6 e2fsck 1.43.4 (31-Jan-2017) ext2fs_open2: Bad magic number in super-block fsck.ext3: Superblock invalid, trying backup blocks... root was not cleanly unmounted, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Free blocks count wrong for group #0 (4245, counted=11608). Fix? no Free blocks count wrong for group #1 (1373, counted=707). Fix? no Free blocks count wrong for group #2 (1699, counted=1880). Fix? no (...) Inode bitmap differences: -(57345--131072) -172034 -172037 -(172042--172043) -172045 -172047 -172049 -172053 -172057 -172059 -172062 -172065 (...) Fix? no root: ********** WARNING: Filesystem still has errors ********** root: 91692/876544 files (0.8% non-contiguous), 1413337/3497984 blocks
I understand that due to some unknown reason Linux can't mount this filesystem. I would like to know why - is filesystem broken, or is there some other reason? And I would like either to mount this filesystem or somehow recover its files.
What should I do now to troubleshoot this problem?
EDIT: I want to thank everybody for help! Finally I found - using fsck - that the partition does contain Linux ext filesystem, but the filesystem is broken and this is why I could not mount it. I did a backup of the card (with "cat /dev/sdc | gzip > mybackup") and then checked if the device contains bad blocks. It does not contain any bad blocks (maybe the filesystem on the SD card was broken by usind it with a broken SD card reader?), so I just fixed the filesystem with fsck, put the card in the Raspberry Pi and then it booted without problems.