1

After installing Ubuntu MATE on my Raspberry Pi 2, everything works fine, for once. However, the site I am following to set it up tells me I have to resize the file systems. It tells me to delete the second partition, which, upon close examination, holds the root of the system! (partition 1 holds the boot) Deleting the root partition seems like a bad idea.

Is it necessary to go through with this step, despite the fact that everything works great already?

What are the benefits of taking this step?


Similar question here: Resize file system on OpenELEC

3

It does not say that you have to resize the filesystem. It does have a section describing how to do it. Notice the page is not structured step 1, step 2, step 3. It is simply organized under various headings.

If you did want to to resize, the process referred to there is fairly standard but the way it is described is very abbreviated and might easily confuse the unfamiliar. The two basic steps are:

  1. Change the partition table entry.

  2. Restructure the filesystem.

These two steps correspond to the distinction between a block device partition and a filesytem. The former contains the latter. Physical storage devices, as I am sure you are aware, can be "partitioned" into a number of discrete segments. Each one of these is referred to as a partition.

Most often to be made useful a partition is then formatted to contain a specific kind of filesystem, but a filesystem and a partition are not synonymous and the distinction is very clearly defined although it may often be ambiguous to many users. In any case, the point in step one about deleting the partition really just means just deleting the entry in the device's partition table. This does not affect any data in the filesystem on that partition. The idea is to then re-create the partition entry and make it bigger. This is necessary before you can make the filesystem inside it bigger. It is kind of a hands on method but remember -- the pi is all about learning.

However

There is a very important caveat here that the ubuntu mate crew neglect to mention, namely, when you re-create the new partition, it absolutely must have the same starting sector as the one you just deleted, or you may end up destroying or losing the filesystem inside. There is the assumption on that page that using the fdisk defaults will handle this. I cannot say one way or another WRT the ubuntu mate image (it is possible this is true), but I can tell you for certain this is NOT true using a Raspbian image, i.e., if you followed those directions, you would be making a mistake.

Perhaps they ran out of space after what was required at the top for all their "Please send me money, I created an SD card image" stuff (excuse my sarcasm and do not let that stop you from donating, I am sure they mostly do a good job). The pi may be all about learning but beware that does not always mean it is always about teaching, so sometimes "learning" might mean "the hard way".

  • The default for Ubuntu should work. Unfortunately they did not locate the partition on a 4M Erase Block boundary. I moved mine and in this case you definitely need to specify the starting sector. – Milliways Jan 8 '16 at 5:44
0

The problem with flashable uncompressed binary images (typically used for OS installation for RPis) is that they hold the contents of the entire disk, including a partition table. And by that I mean, the image also includes some free space so you can install some packages without doing anything but flashing and booting. That's one more reason to compress them: why bother with downloading empty space?

Right after you've flashed the image you have the exact same amount of disk space (total, both used and free) that the source image had (typically < 1.5 GiB) with partitions laid out as follows:

{[ boot ][    root    ]  unallocated   }

A lot of space not used by any filesystem, because the SD card happened to be larger than the image. Flash drives differ, they have slightly different amounts of disk space, so it makes sense to publish an image with a minimum amount of free space and let the user adjust the results for his own drive.

You can safely extend the root partition after flashing the image. You can either:

  • use fdisk to carefully remove that partition and recreate a larger one starting in the exact same place (so filesystem structures happen to work as they did before) and then resize the filesystem inside it to fit
  • use a GUI partition editing software (I used gparted) that has an operation of "resizing a partition" that resizes both partition and filesystem at once (from user perspective), it just feels safer, but down below it's about the same. Just make sure it works well with ext3/ext4 filesystems (as gparted does).

I did this before the first boot for multiple OSes now (Raspbian, Hypriot Docker, Snappy Ubuntu Core), I believe this will work with Ubuntu MATE too.

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.