2

Right now I'm using my Pi as a OwnCloud file server. I'm using a 16G usb stick as a boot disk because I wanted more speed and space. This have been working perfect until today, I now have a total of 7G (the total space of my old SD-card) and if I run the df commend it says I only have 7G of storage but it could be 14G total (total space of the usb). I tried to use the expand file system in rasp-config but it didn't work because it was a usb stick. I've been searching for some time now whiteout any result. Any suggestion what to do?

1

Quoted from http://elinux.org/RPi_Resize_Flash_Partitions#Manually_resizing_the_SD_card_on_Raspberry_Pi

Just make sure where it says /dev/mmcblk0 it's its changed to your USB device, and where it says /dev/mmcblk0p2 its referring to the RIGHT PARTITION on your USB device.

Manually resizing the SD card on Raspberry Pi

You can also resize the partitions of the SD card that your Pi is running on.

First you need to change the partition table with fdisk. You need to remove the existing partition entries and then create a single new partition than takes the whole free space of the disk. This will only change the partition table, not the partitions data on disk. The start of the new partition needs to be aligned with the old partition!

Start fdisk:

sudo fdisk -cu/dev/mmcblk0

Then delete partitions with d and create a new with n. You can view the existing table with p.

  • p to see the current start of the main partition
  • d, 3 to delete the swap partition
  • d, 2 to delete the main partition
  • n p 2 to create a new primary partition, next you need to enter the start of the old main partition and then the size (enter for complete SD card). The main partition on the Debian image from 2012-04-19 starts at 157696, but the start of your partition might be different. Check the p output!
  • w write the new partition table

Now you need to reboot:

sudo shutdown -r now

After the reboot you need to resize the filesystem on the partition. The resize2fs command will resize your filesystem to the new size from the changed partition table.

sudo resize2fs/dev/mmcblk0p2

This will take a few minutes, depending on the size and speed of your SD card.

When it is done, you can check the new size with:

df -h

1

I personally had some difficulties while trying to format my SD card by the method stated by ExploWare and as a result lost the configuration on it.
It is advised you backup your files on the USB drive before you attempt it.

Generally it should be faster, safer and easier to plug your USB drive into a linux PC and do the resizing with GParted.

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.