1

I bought my Raspberry with a Kingston SD that came pre-loaded with a bunch of system images. I used the raspi-config to make two partitions, one in which I installed raspberry wheezy and another where I think I installed Archlinux (long time ago, so the details are not clear!).

I've only used the raspberry wheezy and now that I'm out of space I'd like to erase the other partitions and then expand either my raspberry wheezy partition or the filesystem one. Also, I don't care for the other system images that came pre-loaded, so those can go too.

Because of my very, very limited knowledge of linux, I don't know which one to erase or how to determine that! I'll print a few relevant command below, but if I'm missing some info, let me know in the comments and I'll update. These commands are all run from the wheezy partition.

sudo fdisk -l

Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
4 heads, 16 sectors/track, 243200 cylinders, total 15564800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a6d66

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192     3011718     1501763+   e  W95 FAT16 (LBA)
/dev/mmcblk0p2         3014656    15499263     6242304   85  Linux extended
/dev/mmcblk0p3        15499264    15564799       32768   83  Linux
/dev/mmcblk0p5         3022848     3227647      102400    c  W95 FAT32 (LBA)
/dev/mmcblk0p6         3235840     8325119     2544640   83  Linux
/dev/mmcblk0p7         8331264     8454143       61440    c  W95 FAT32 (LBA)
/dev/mmcblk0p8         8462336    15497215     3517440   83  Linux

and

cat /etc/fstab

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p7  /boot           vfat    defaults          0       2
/dev/mmcblk0p8  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that

and finally

df
Filesystem     1K-blocks    Used Available Use% Mounted on
rootfs           3396660 3373676         0 100% /
/dev/root        3396660 3373676         0 100% /
devtmpfs          218604       0    218604   0% /dev
tmpfs              44576     256     44320   1% /run
tmpfs               5120       0      5120   0% /run/lock
tmpfs              89140       0     89140   0% /run/shm
/dev/mmcblk0p7     60479   14536     45943  25% /boot
tmpfs              89140   89140         0 100% /tmp
2

Before you do anything, power off your pi and backup the ENTIRE sd card. Better safe then sorry. Since you are running these commands from the OS you are looking to keep, the partitions you need are mmcblk0p7 and mmcblk0p8. You can delete a partition using the command line, but I would suggest using a GUI such as gparted, as it allows you to review changes before writing to disk. Delete the unwanted partitions, then run raspi-config and choose to expand file system. After a reboot, it should be good to go!

Some info you may be interested in: https://serverfault.com/questions/451124/which-partition-is-my-os-installed-on

http://www.cyberciti.biz/faq/linux-how-to-delete-a-partition-with-fdisk-command/

  • 2
    Watch out: mmcblk0p2 is an extended partition. MBR formatted devices such as the pi's SD card can only have four primary partitions. In order to create more, an "extended" partition can be created to contain a set of logical partitions. From the looks of things, 5, 6, 7, and 8 are logical and contained in the extended one (2). So don't delete 2, and I am sure you need 1 as well. Also, afterward the partition numbering will have changed and you will need to edit fstab appropriately. – goldilocks Apr 8 '15 at 9:58
  • 1
    @goldilocks -Good point. This can be seen in under fdisk -l, partitions 3-8 are within the start and end values of mmcblk0p2. I will try to find some work arounds for this and edit my answer with any findings. – wahoozie Apr 8 '15 at 13:13
  • 1
    @cd98 Sorry for the delay, been busy and I wanted to make sure I did the proper research. I have found a tool called fixparts which can make a logical partition into primary, and vice-versa. Can anyone confirm that this tool can make the partition available at boot without manually changing any files? – wahoozie Apr 13 '15 at 21:28

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.