-1

This question already has an answer here:

Extracted from the instructions from the original docs for installing Ubuntu on RaspBerry Pi 2:

There are no Raspbian-specific utilities included, specifically no automatic root resizer. However, it's not hard to do manually. Once booted

$ sudo fdisk /dev/mmcblk0

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then:

$ sudo resize2fs /dev/mmcblk0p2

By using this method, the 2GB root partition extracted from the .img Ubuntu file can be expanded to the full size of my, say, 32GB SD card.

Is it possible to revert this step to shrink the, say, 32GB root filesystem size, to something smaller like, say, 4GB (assuming, of course, that filesystem has no more than that 4GB data full)?

marked as duplicate by goldilocks Jul 19 '15 at 11:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Questions about resizing linux partitions really belong on Unix & Linux; fdisk and resize2fs aren't unique to the Pi or Ubuntu. See also man resize2fs. You can do this in reverse but the filesystem must be unmounted. – goldilocks Jul 19 '15 at 12:10
2

I think the easiest way is to connect the card to Linux PC and shrink the partition via GParted.

  • Well, indeed, this is the (nearly) obvious method. My question was rather talking about reverting the same method or similar, due to the advantages of not needing a second computer. Anyway, your answer is correct. I will, however, give priority to more directs methods. – Sopalajo de Arrierez Jul 19 '15 at 11:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.