If i put sd card in raspberry pi and want check whether it is working or not. Is there any procedure in raspberry pi to check it. I want to check my either my SD card is broken down or corrupted.

2 Answers 2


The following are steps I usually use to check any (micro)SD and/or USB memory sticks when I plugged into a USB port on my Linux desktop computer. Since your Rpi presumably runs on a Linux OS, I would not hesitate to share it here with you.

  1. Before I insert any USB devices and/or storages, I usually run a Linux dmesg utility to dump out the latest information the utility will report and make a note of the last line. Once the USB storage is inserted into a USB port, I rerun the Linux dmesg utility to dump out the information about the USB storage. This way, I can be sure the 2nd run produces the information I need in its few last lines that clearly shows which device the USB storage occupies and/or how many partitions the USB storage has.
  2. Also, I can basically run any (c)fdisk /dev/[disk], parted /dev/[disk], and/or gparted /dev/[disk] (GUI version) to look for the partition table(s) of the USB storage. Note, /dev/[disk] is the USB storage disk in question. For a microSD card, it is usually a /dev/mmcblk0p1 (1st partition), /dev/mmcblk0p2 (2nd partition), etc., when it is inserted into a microSD slot of the Rpi device. If you use a microSD card reader, then perhaps it will be mounted as /dev/sdX1 (1st partition), /dev/sdX2 (2nd partition), etc., where X is the disc and usually is b, c, d, etc.
  3. Once I have the partition, I can run a fsck /dev/[partition] to check the condition of the partition. If it reports any corruptions, I usually run it again with -fy switch, i.e. fsck -fy /dev/[partition], to automatically fix the partition. Remember, this is a destructive act. So, unless you know what you are doing, you may wanna do a backup of the USB storage using a Linux dd utility prior to issuing such a command. I usually ignore the backup.
  4. Once the above action is done, I usually repeat the above process again 1x to ensure it completely removes the corrupted files.
  5. Once I ensure the USB storage gets fixed, I usually mount it, i.e. mount /dev/[partition] /mnt, etc., to check its integrity. While doing so, I would also look for some generated files (usually with extension .chk) and/or files under the lost+found directory on the root directory of the USB storage. If you mount your USB storage on /mnt directory, then you can check /mnt/lost+found subdirectory to see any recovered files there. I usually just delete them to free some spaces occupied by the files, but they may be invaluable to you to peruse and/or save.

That's all there to it and I hope it will help.


Following the answer from @user91822 is a good advice. This all will check if the filesystem is corrupted and will repair it. B.t.w. this will be done on every boot as long as you have set fsck.repair=yes in /boot/cmdline.txt. This is the default setting on Raspbian so mostly just a reboot may fix software errors within the file system.

But this all does not work if the hardware of the SD Card does not work properly anymore. The hardware of a SD Card does not report write errors so the operating system means everything is ok but single bits may not be stored. To check this kind of error you have to do a read after write check on the SD Card with unbuffered I/O. To get more information on this you can look at Detect an SD card that became read-only.

Your Answer

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

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