I'm running RetroPI, I believe it's on top of Raspbian -- Linux 4.4.38-v7+ armv7l GNU/Linux.

So, my PI boots fine, and is running fine, but I started noticing some random garbage files showing up in my ~ directory when I run the "ls" command via putty, in addition to the normal files I expect, I also see these file entries:

  • ȥ??hţ?
  • 0??

(I do get tab completion on these, instead of the "?"s that ls shows, but the files are truly garbage symbols.)

When using WinSCP, I notice other strange files (might be the same ones, not sure):

  • 0¥ç
  • È¥£hÅ£
  • ÈÅŒ

They're all about 8 KB according to WinSCP (ls -s just prints an "8" next to them, but I don't know how to verify that 1 block == 1 kb.)

I've shut down my PI with a hard power off a few times, so I'm guessing my SD card has some minor corruptions on it.

I don't have Linux on any other machine, just the raspberry PI. How can I perform an online check and repair of the file system from the Raspberry PI itself? (I do not have any X windows shells or GUIs installed, it's a Retro PI system, and I don't know how to install the GUI with that, so the command line is all I've got.)

Here's a list of my partitions:

pi@retropie:~ $ sudo parted /dev/mmcblk0 'print'
Model: SD 00000 (sd/mmc)
Disk /dev/mmcblk0: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  64.0MB  59.8MB  primary  fat16        boot, lba
 2      64.0MB  16.0GB  16.0GB  primary  ext4

I was able to make the following command work to check the first partition, but I have no idea how to check the second one:

sudo dosfsck -w -r -l -a -v -t /dev/mmcblk0p1

I tried changing "mmcblk0p1" to "mmcblk0p2" and also "dosfsck" to "fsck", but neither of those worked out very well for me. -- I got a warning that the file system was mounted and that attempting to repair it would destroy it?


Question 1: how do I repair this file system (Without another PC running Linux)?

Bonus Question: Is there a way to mount the core OS as read-only at boot-up (so that I can kill the power with little-to-no-risk), but retain my emulators / roms / and save games in a read/write partition? (So that the SRAM files, save states, etc. will work?) -- What's the best strategy here?

  • Trying this without Linux or even while the system is online is futile. Tools like fsck.ext4 and kpartx simply aren't available under Windows. Use a Live CD or VirtualBox / VMWare.
    – flakeshake
    Commented May 15, 2017 at 6:31

1 Answer 1


Before doing anything else, make a copy of the SD card. (The image itself, not the files in the filesystem (not with winscp).)

To mount the root filesystem at boot time, so that you can run the dosfsck command in your question, try the technique explained in this article.

What the article explains is a good idea to do in general, unrelated to your current task of checking the disk. An easier alternative would be to check the disk from another computer. Although you wrote you don't have a Linux machine, you don't need one. You can boot your Windows PC into Linux using a Live CD, which let's you run Linux on your computer without installing it. Most modern distributions work this way. You could try for example Ubuntu.

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.