Resize boot partition, transfer free space from other partition
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
No need for that just clean out the accumulated junk files in your / partition, getting back the space taken up by useless files doing nothing but causing problems. Some of the time OSs cache the files downloaded to update the OS this is the first place to look, another is du -h / look for the directories taking up the most space, du -Sh /path/to/dir | sort -rh | head -20. The 20 being the number of directories to show you can leave the | head -20 off entirely to show everything. On the largest directories start investigating to see what can be eliminated to regain space. You have about 50GB of wasted space with the separate /home if necessary you could copy the / there and set it as the boot partition using fdisk. You would move all the files, the user_name directory that will be there now into the copied / in the /home directory that will be in there now and unused and eliminate the line in the /etc/fstab for its use on separate partition, changing the / to the new. Or if still wanting separate then move the user_name directory to the old / partition the / to the old /home change the /etc/fstab to reflect the new locations and then use fdisk to change boot flag to new partition of /. It all should just work, best done booted from a live media such as an Ubuntu install disk in Terminal for the commands to do the moving around.
Last edited by HappyTux; 11-30-2021 at 09:05 AM.
Reason: typos
No need for that just clean out the accumulated junk files in your / partition, ...du -Sh /path/to/dir | sort -rh | head -20.
Thx HappyTux for that fast & useful answer!
I followed your advice and found around 6 GB of 'trash' in folders like '/.local/share/Trash/files', Downloaded packages, old Kernels and Browser cashes. So no more warnings like "Insufficient disk space..." or even boot errors/stops after packet updates etc.
Nevertheless, I am curious if and how an extension of the boot partition would be possible.
Do you feel like explaining this process to me/us based on my environment?
/dev/sda2 is an extended partition which is basically a container for logical partitions i.e /dev/sda5-9.
I noticed that /dev/sda5 and /dev/sda7 are not being mounted, are they used for anything?
To free space for /dev/sda1 you would need to:
Delete or shrink an existing logical partition to create unused space.
move logical partitions to the left inside the extended partition
Shrink the extended partition
Move the extended partition to the right so that /dev/sda1 has adjacent unused space.
Extend /dev/sda1 partition as well its filesystem.
Moving partitions around is not entirely without risk so having a good backup just in case is suggested.
The image in your first post shows the / (root filesystem) partition as sda1 which also contains all the boot files.
Before you can extend/increase that partition, you will need space continguous to it to expand to. In your case, you are using the older msdos/Legacy install which limits the user to 4 primary partitions, you have only used 2 = sda1 and sda2.
sda2 is an Extended partition which is used to create Logical partitions on which to store data. Note the size of sda2 then add the combined sizes of sda5 through sda9 and they should be the same.
You would first need to use a live cd/usb so that the partitions are not mounted and thus can be changed. Shrink sda5 by moving it to the right, then move sda2 to the right also. Then you should have unallocated space between sda1 and sda2 to use to expand sda1. You need a 'live' system as you can't modify partitions which are in use.
The GParted Manual is at the link below, read the section on Resizing a Partition.
I followed your advice and found around 6 GB of 'trash' in folders like '/.local/share/Trash/files', Downloaded packages, old Kernels and Browser cashes. So no more warnings like "Insufficient disk space..." or even boot errors/stops after packet updates etc.
Nevertheless, I am curious if and how an extension of the boot partition would be possible.
Do you feel like explaining this process to me/us based on my environment?
Thanks again
SB
You are welcome good to read you get it sorted. If I had a single clue on how to do a resize of a partition I would share the idea with you but I have never done it. Well on my Mac I have but that is GPT partitioned drive and Disk Utility takes care of all the details for you, there is way to do it in Terminal but like I have said never done it that way. A quick search leads me to this answer.
Note the procedure for moving the extended partition in post #5 should be followed, in preference to that in post #4.
You can not shrink sda5 without creating unallocated space first by shrinking a logical partition. To shrink sda5 you need to move all logicals to the left first.
gparted does many steps automatically like shrinking the filesystem when you shrink the partition.
OOPs didn't read it closely enough - the idea is right tho'. Shrink and move the logicals to the right first - then mereley drag the left edge of the extended across to free the space. Move the data only once.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.