4

I've got my 4GB SD card full and Raspbian won't complete the boot process.

Is it possible to access the file system on a different computer (by plugging in the SD card) and editing/deleting files there? If so, how?

  • 1
    What operating system you're using on computer which plug the SD card? – gurcanozturk Sep 11 '13 at 13:38
5

Yes, the most obvious and straightforward way is to mount them under linux, where ext4 is the native filesystem. Keep in mind that the raspberry pi is not actually the focus of the linux world -- not including android (which uses the kernel), between 1-5% of PCs (desktops, laptops, etc), 30-40% of web servers, and 95% of the world's supercomputers run some flavor of GNU/Linux, of which Debian is a primary stream (and raspbian an offshoot of debian). So that's well into the tens of millions of users and you have plenty of options to choose from -- most of which are, like raspbian, distributed without charge.

If you don't want to install linux on a PC, you could use a "Live CD". This is an install disk that boots a normal, running OS from a CD or DVD so you can try it out. It doesn't actually install anything unless you ask it too, and they are generally useful for doing recovery things -- you could certainly mount the SD card. Most distributions, including debian, have a live DVD (nb. Intel 64-bit architecture is part of the 'amd64' stream for debian; other distros call it 'x86_64'). You just download the .iso image and burn it onto a disk. Note you do not have to use debian, and you can generally presume that any install disk you download will work as a live disk, including ubuntu and fedora.

Running from a DVD can be a little slow but it should be fine if you just want to check the SD card in an environment that is actually equipped to repair something if necessary (mostly meaning: you can run e2fsck on the partition). It is also very easy -- again, just download the .iso, burn the disk, boot it. You can also do this with a USB stick.

Running a live CD doesn't allow you to save a configuration of anything, etc. however. A popular choice in recent years, now we all have beefy multi-core systems that can do it smoothly, is to run a virtual machine with linux inside windows or OSX, so that you do not actually have to install it to a partition or boot it, but you can maintain the system on a hard drive.

Finally, while Microsoft and Apple are evidently adverse to including ext4 support (there's nothing stopping them from doing so), it is not impossible to get it there (I can't endorse any of those methods as I have not tried them, but there must be something stable around). However, again, you will not be able to repair the filesystem that way.

  • 2
    I successfully used a variation of your suggestion: I've installed VirtualBox(with the Extension Pack to share usb devices like the internal sd card reader) and created a virtual machine with no HDD image, booting a live cd image of lubuntu(a smaller ubuntu distro) – George Profenza Sep 14 '13 at 12:10
  • @GeorgeProfenza You should expand your response to a full answer. – ThomasW Feb 14 '15 at 11:53
5

In addition to mounting the ext4 partition of the SD card as @goldilocks suggests, you should be able insert the SD card into any Windows machine and edit cmdline.txt in the vfat /boot partition (which should be directly available to Windows) and add the following parameter to the line that is already in that file:

init=/bin/sh

According to this posting, this tells the kernel to run /bin/sh instead of /sbin/init.

This should allow you to list out the contents for the root file system and then delete anything you don't need to free up space in the file system.

You would then need to edit /boot/cmdline.txt and remove the init=/bin/sh parameter. You can use vi or nano to perform that update.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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