0

I had a raspberry-pi starter kit shipped with an SD-Card with already installed Distributions. Now working with wheezy, I wanted to delete the other distributions on my sd card. Where are they and how can I delete them?

command: df -h

Filesystem      Size  Used Avail Use% Mounted on
rootfs          6.3G  6.2G     0 100% /
/dev/root       6.3G  6.2G     0 100% /
devtmpfs        212M     0  212M   0% /dev
tmpfs            44M  256K   44M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            88M     0   88M   0% /run/shm
/dev/mmcblk0p5   56M   16M   41M  28% /boot
1

Try du du -sch /* it will break down your space usage for you. You can also list all large files with find find . -mount -type f -size +1M -exec ls -lh {} \;. Though if you only have a 8GB card you may want to not use NOOBS and instead use a slimmed down version of raspbian (minibian, pipaos, etc) . If your card is larger than you may need to expand the file system with raspi-config. or mess with other partitions; please edit your question to include the output of lsblk.

  • is it somehow possible to slim down Noobs without deleting everything? – user1767754 May 4 '15 at 12:27
  • @user1767754 You can't slim down anything without deleting something, and you won't have anything if you delete everything, so your comment makes no sense. Please try again. Why do you want NOOBS? it's just waste of space if your not using it. – user1133275 May 6 '15 at 18:25
0

Have a look at mount | grep mmcblk0p2, e.g., from a typical (non-NOOBS) pi:

/dev/mmcblk0p2 on / type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p1 on /boot/rpi type vfat (rw,relatime,...)

Anything that's actually mounted you should probably keep; the other partitions you can do what you want with. You can get a list with ls -1 /dev | grep mmcblk0p. Anything in the second list not in the first list is not in use. Note the first line above, with on /. That partition is your root filesystem.

Now, back up /boot/cmdline.txt in case what I am recommending here doesn't work, I do not have a NOOBS card to try it on.1 Edit cmdline.txt and find root=/dev/mmcblk0p?? and change whatever ?? is to whatever your root filesystem partition is (in the example above, 2). It might be so already.

If everything now boots okay, you can reformat stuff in those unused partitions. You can get the sizes with sudo fdisk /dev/mmcblk0, then p to see the partition table. You can also delete and replace adjacent partitions to make a larger partition with fdisk, but that is another question (I'm sure you'll find stuff online about this).

When you have a partition you want to use, sudo mkfs.ext4 /dev/mmcblk0p?? where ?? is the number. Remember, do not do this to something that was shown in mount.

If you want to transfer, e.g., your home directories there, make sure the users are logged out (i.e., log in as root), then:

mkdir /mnt/extra
mount /dev/mmcblk0p?? /mount/extra

There should be no errors. Check in /mnt/extra. It should contain one directory, /lost+found. Then:

cp -a /home/* /mnt/extra

/home and /mnt/extra should now be identical. There should not be a /mnt/extra/home -- that means you left the /* off.

When you are sure this is all good, you can delete everything in /home, but keep it as a directory: rm -rf /home/*. This will free that space up in your root partition.

Add a line to /etc/fstab:

/dev/mmcblk0p??    /home    ext4    defaults,noatime  0  3

This will mount that new partition on /home at boot so everything is normal. You can try that now:

 umount /mnt/extra
 mount /dev/mmcblk0p?? /home

Remember, don't really use ?? anywhere. You should be able to log in as pi or whoever and find your normal home directory.


1. In fact, I strongly recommend you back the whole card up before you try this, just in case.

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.