0

My SD card is not booting more. This is the error end Kernel panic - not sycing: VFS: Unable to mount root fs on unknown-black(179,2) I tried many wasy to boot it that are given on internet, no solution work. Now the issue is I did lot of programming work on it and my program file is reside in it. Its effort of many days and night. I want to recover that .py file.

I tried many ways to recover that file also, I don't find solution of it. When I open it on windows or Linux system via SD card reader or USB card reader it only shows one boot partition containing all those files that are usually reside when we first time write SD card with raspbian operating system.

I also tried this solution that is given in answer but it didn't work:

when I paste this command in terminal: sudo fdisk -l /dev/sdb it showed sdb1 and sdb2 partitions.

Then I used sudo e2fsck /dev/sdb2, it showed rootfs: **** WARNING: Filesystem still has errors *****

So the next command sudo mount /dev/sdb2 /mnt/whatever not work and showed that mount: /mnt/whatever: mount point does not exist.

Is there any way to recover that programming file. If yes kindly provide me solution of that. I will be very thankful to one who solve my problem!

1
  • By "where /mnt/whatever is an empty existing directory" I meant, /mnt/whatever must be an empty existing directory. It doesn't matter what it is called (it actually doesn't matter if it is empty either, but it will be less confusing if it is). Put another way, create some directory some where and use it as a mount point. That's what mount points are.
    – goldilocks
    May 12, 2019 at 17:54

2 Answers 2

3

The reason you cannot see anything but /boot from Windows is that /boot is formatted as a FAT (or FAT32) partition (which Windows can read), while the root filesystem / is formatted as an ext4 filesystem (which Windows cannot read).

You should be able to read the ext4 root filesystem in Linux, assuming your version of Linux supports ext4. If your Linux distro doesn't support ext4, you must find one that does (another RPi w/ Raspbian, or Ubuntu for example).

If it does, then you should be able to remove the SD card from your RPi, insert it into (for example) a USB adapter that accommodates SD cards, then read anything in your root filesystem. If you cannot, then it seems likely that your SD card is corrupted.

2
  • 3
    It's pretty hard to find a linux system which isn't ext4 based, especially on a normal PC or laptop.
    – goldilocks
    May 10, 2019 at 13:45
  • @goldilocks: agreed, just trying to cover all the bases
    – Seamus
    May 10, 2019 at 14:06
1

When I open it on windows or Linux system it only shows one boot partition

You haven't explained how you opened it, but if you can find the boot partition on linux you should be able to find the root fs.

First you need to figure out what the device node is, an easy way to do this if you are not sure is to run:

ls -1 /dev > dev1.txt 

Without the card in the computer. Then put it in, and run

ls -1 /dev > dev2.txt
diff dev1.txt dev2.txt

If your computer has an SD card slot the device will probably be similar to what it is on the Pi, mmcblk0, then the two partitions will be mmcblk0p1 and mmcblk0p2. If you are using a USB adapter, it will instead be an sd device, sda or sdb etc.

You can then double check that with sudo fdisk -l /dev/sdb. This is the device node without the partition number at the end. You'll see a table which describes your SD card, the little vfat partition and the big ext4 one (fdisk may refer to the latter as just "Linux" but the size should be correct).

Then try sudo e2fsck /dev/sdb2; this is to check the filesystem on the second partition. This may ask you about making repairs, these are usually not too many.

Once that's done you should be able to mount it with sudo mount /dev/sdb2 /mnt/whatever, where /mnt/whatever is an empty existing directory.

If that doesn't work, paste the output from fdisk -l into your question.

1
  • Hi @goldilocks, I applied your solution but it didn't work. I explained it in question. kindly take a look at it. May 11, 2019 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.