Fabian_Debian
Posts: 9
Joined: Thu Dec 12, 2013 3:02 pm

how can I modify the RPi SDcard under windows?

Mon Dec 30, 2013 3:12 pm

I might have misplaced some files again and in turn, fried all the free spaces and now my raspbian has no sufficient root space to run on.

This happened a couple of times before and I find it quite a nuisance. Is there any tool that I can use to modify the SDcard without booting into raspbian? Since you know, I'm not able to boot into it in the first place?

User avatar
DougieLawson
Posts: 39884
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: how can I modify the RPi SDcard under windows?

Mon Dec 30, 2013 3:22 pm

Does your RPi boot OK?
Because it's much easier to use a RPi to fiddle with the ext4 filesystem.

If it does there's a bunch of cleanup you can do that's trivial.
sudo -i
cd /var/log
find . -name "*gz" | xargs rm # cleanup old gzipped log files
apt-get autoclean
apt-get clean
exit

Or boot your laptop from a Knoppix CD/DVD and use it to access your SDCard
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Fabian_Debian
Posts: 9
Joined: Thu Dec 12, 2013 3:02 pm

Re: how can I modify the RPi SDcard under windows?

Wed Jan 01, 2014 1:25 am

DougieLawson wrote:Does your RPi boot OK?
Because it's much easier to use a RPi to fiddle with the ext4 filesystem.

If it does there's a bunch of cleanup you can do that's trivial.
sudo -i
cd /var/log
find . -name "*gz" | xargs rm # cleanup old gzipped log files
apt-get autoclean
apt-get clean
exit

Or boot your laptop from a Knoppix CD/DVD and use it to access your SDCard
Thank you!

It didn't boot up fine, it froze up in the middle of the booing process. I'll try the Knoppix cd thingy though, I'll see what it does.

Fabian_Debian
Posts: 9
Joined: Thu Dec 12, 2013 3:02 pm

Re: how can I modify the RPi SDcard under windows?

Wed Jan 01, 2014 1:26 am

Please people, any help is appreciated!

User avatar
DougieLawson
Posts: 39884
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: how can I modify the RPi SDcard under windows?

Wed Jan 01, 2014 1:58 am

I assume your laptop has a SDCard reader, if not get a Fuji USB Reader for a couple of quid.
I also assume your laptop has an optical drive and you have some software to take an *.iso and create a bootable CD.
I also assume your BIOS isn't locked down and your laptop can be encouraged to boot from the optical drive.

Knoppix is a Linux system (like Raspbian) that can be run without doing anything bad to your Windows harddisk (although there is an option to make your machine dual boot either Windows of Knoppix).

Grab the cd from here: http://www.knopper.net/knoppix-mirrors/ ... rrypi.com/
Burn, boot and you get a funny desktop.

Insert the SDCard.
Knoppix should automount any (clean) partitions it can recognise.

Open a command window (this is like logging in to your RPi). We can use dmesg to see what partitions are on the SDCard. We can use mount to see what partitions have been automounted. We can use fsck to do a filesystem check of the SDCard.

So we have a fully fledged system that we can use to tinker with our RPi SDCard (while the RPi is down).

First thing to do is take a copy of the SDCard so that if we mess up we can get back to the current status.
mkdir =p /windows/c/somewhere/safe # I think Knoppix mounts your Windows C: drive on /windows/c - CHECK that

Unmount everything. We shouldn't tinker with mounted filesystem.

umount /dev/sda1
umount /dev/sda2
umount /dev/sda5
umount /dev/sda6

Get a backup

dd if=/dev/sda of=/windows/c/somewhere/safe/sdcard-2014-01-01-01.img bs=10M
then when that copy is complete

fsck -aw /dev/sda1 # NOOBS recovery FAT partition
fsck -y /dev/sda2 # NOOBS ext4 partition
fsck -aw /dev/sda5 # Raspbian FAT partition
fsck -y /dev/sda6 # Raspbian ext4 partition
# I'm assuming the SDCard appeared as /dev/sda when you inserted it.

once that's complete take a belts and braces copy

dd if=/dev/sda of=/windows/c/somewhere/safe/2014-01-01-02.img bs=10M
shutdown -h now # we're done with Knoppix for now.

Eject the CD, Pull the SDCard and press enter your machine can boot back into Windows
Stick the SDCard back in your RPi, boot and it should be good to go.
If it isn't then we'll need to boot to NOOBS recovery (by holding the SHIFT key) and run through that process.

We've got two backups (hiding in the c:\somewhere\safe directory) on Windows (so we can use Win32DiskImager with those).

HNY 2014
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6239
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: how can I modify the RPi SDcard under windows?

Wed Jan 01, 2014 3:12 am


Return to “Troubleshooting”