0

enter image description here

Recently I've found out that soon I will run out of space on my / (root) partition. I've done some research on extending root partition, however, it wasn't too informative (mostly everyone say it's impossible or at least too hard). However I don't want to give up.

Here is my partition configuration in the photo. After root /dev/sda6 partition I have some free space (I don't know why it is here and where it came from). Then goes /home on /dev/sda7 and then more free space (9.77 GiB). What I'd like to do is to add these 9.77 GiB to my root partition. I've already read that I need to move my free space to the left and place it right after root partition (or to do something like this), but I don't know how.

Also another solution, as I see it, can be shrinking /home partition. I've already tried it with /dev/sda7 (that's where those 9.77 GiB are from), but free space appears on the right from /home, not on the left as I need.

This photo was made from my system, but if needed I can boot from Ubuntu LiveUSB.

1

The simplest way to do this is:

  1. manually copy the ~7GB of files from the /home filesystem to an external media device
  2. delete the /dev/sda7 partition
  3. increase the size of the /dev/sda6 partition
  4. grow the ext4 filesystem on /dev/sda6
  5. create a new /dev/sda7 partition in the remaining space
  6. format the new /dev/sda7 partition with an ext4 filesystem
  7. copy the original files from the external media device to the new /dev/sda7 filesystem
  8. make sure /etc/fstab points to the correct block device for /home

This requires a fair amount of checking things, documenting the current state, etc.

I am not a regular Ubuntu user, so I don't know how the block devices are referenced to the mount points. Some systems use simple device mapping (/dev/sda7 /home), some use dev-mapper, some use block-id UUID identifiers.

The specific command syntax to complete each point will vary GREATLY depending on what toolset and operating system you are using. It's too much for a single post here, without a lot more information.

You should also be aware that any time you change the partition table on a physical disk, you risk damaging data anywhere on the entire disk if you are not careful to use the correct commands and parameters.

Using a LiveOS to make the changes to the physical disk is a Good Idea(TM), and I suggest you consider the free System-Rescue-CD, which is built with the intent of providing tools to work on problems just like this.

0

I don't know why it is here and where it came from

Those are UEFI boundaries.

What I'd like to do is to add these 9.77 GiB to my root partition.

Steps:

  1. merge sda7 with the 9.77Gib unallocated space.
  2. shrink sda7 and create new unallocated space at the beginning.
  3. merge new unallocated space with sda6.

Use a live session to do this and finish each of these before doing the next one. It is not too difficult since gParted will sort of guide you through that process. Do make a backup before you start.

Just a remark: there are other methods. 23Gb is a LOT for / without a /home/. I have servers with Apache and Mysql that never reach 20Gb: the data those use are in a mount /opt/ that is a different hard disk. If you have those 2, or a mailserver, or a fileserver it might be better to change the data directory settings for that service and move those to /home/.

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.