This article is similar to this article, except it use fdisk to partitioning.

When write image to CD card for installation of Raspberry Pi, the usable size will only be the size of the image. That means the rest of the space will be waste. On some distribution such as Fedora Remix or Raspbian Wheezy, when final configuration begin the distro run some script to automatically resize and fill the SD card. However not all distro does that. Therefore we need to do manual resize.

In this article we will discuss about how to manually resize SD card on Slackware. Alhtough using Slackware, you can also use other Linux, but we won’t cover that. This article describes activities relating partitions. Incorrectly following instruction is likely to corrupt your system, so please be careful.

On this article I use:

  1. Slackware64 14.0
  2. SD card with Arch Linux ARM  (2GB of 8GB occupied)


Insert the SD card to our machine. Make sure it is now mounted. We will use partition tool to resize the partition.

Following on from the instructions above, keep the newly-written SD card in the card reader, but unmounted. We’ll use the fdisk tool to edit partition record on MBR and other tools to resize the partitions.

Show partition information to find our SD card. Look for a partition that matches the roughly the size of your distribution image. On Arch Linux it should be around 2GB. For example, it is detected as /dev/sdb5. Then unmount that partition. Those can be done by invoking:

Note that in this example case, root partition of Arch Linux is on extended partition.


Now use fdisk with root privileges. You can do sudo if you are on sudoer group or use super user account.

You are asked for command, let’s print what partition there by type ‘p’ character and enter it. Here is my result:

This shows how my SD card was formatted after writing the image.I have 7584 cylinders with total 155352032 sectores.

Notice that nothing use the area from the end of partition /dev/sdb5 (3667967) to the card’s maximum (15532032).

Partition 1 is the boot partition. Nothing to do here, let’s leave that alone. Partition 5 is the root partition which located on the extended partition. This is the partition we will fill in. Some OS versions will have a Partition for swap space, which needs to be moved to the end of the card.

Now grow the root partition. This involves removing the partition, re-creating it, then using resize2fs to grow the filesystem to fill the partition. It won’t destroy any data.

We know that partition 5 (/dev/sdb5) is logical partition and located on Extended partition area. It means we have to remove both partition before creating new one.

First press d to delete the partition 5.

Next, press d again to delete the partition 2

Next we create them. But now we do it in reverse order.

First create partition 2. This will be extended partition. Because our partition is the last partition, we can omit the value and use all the remain area. In my case, I will start from sector 186368 and end it to the 15532031.

Now we have extended partition.

Next, create the partition 5. This partition should be built on top of partition 2.

Now write the changes back to the disk by entering ‘w’.

Next clean and resize the root partition. We will do a filesystem check:

That command will allow it to add lost-and-found.

And that’s it, we can enjoy Raspberry again 😀

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">