LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-30-2021, 08:31 AM   #1
Superblond
LQ Newbie
 
Registered: Dec 2020
Posts: 23

Rep: Reputation: Disabled
Question Resize boot partition, transfer free space from other partition


Hey Forum!

I am looking for help with the following problem!


I'm running a NAS with Openmediavault and now found that the default partitioning that was done at some point during the installation is running full.



Code:
root@NAS:/# df -h
Dateisystem                    Gr▒▒e Benutzt Verf. Verw% Eingeh▒ngt auf
udev                            3,9G       0  3,9G    0% /dev
tmpfs                           798M     45M  753M    6% /run
/dev/sda1                        20G     19G  850M   96% /
tmpfs                           3,9G       0  3,9G    0% /dev/shm
tmpfs                           5,0M       0  5,0M    0% /run/lock
tmpfs                           3,9G       0  3,9G    0% /sys/fs/cgroup
tmpfs                           3,9G     28K  3,9G    1% /tmp
/dev/sda9                        13G    6,4G  5,8G   53% /var
/dev/sda8                        62G    1,9G   57G    4% /home
/dev/sdc1                       3,6T    120G  3,5T    4% /srv/dev-disk-by-uuid-45da65c8-60ec-4e95-921f-023408daa0ba
/dev/sdb1                       5,5T    3,4T  2,1T   62% /srv/dev-disk-by-label-Video
https://webdav.magentacloud.de  1,3T    763G  509G   61% /srv/3123f855-2185-4fb4-b0ce-6d3353964dcb
tmpfs                           798M       0  798M    0% /run/user/0
Code:
root@NAS:/# fdisk -l
Disk /dev/sdc: 3,7 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD40EFRX-68N
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 8A4466DA-28B1-4007-9E26-4B9B514EFF9E

Device     Start        End    Sectors  Size Type
/dev/sdc1   2048 7814037134 7814035087  3,7T Linux filesystem


Disk /dev/sdb: 5,5 TiB, 6001175126016 bytes, 11721045168 sectors
Disk model: WDC WD60EZRZ-00G
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: C4BE9E7D-F90A-44E2-A7F8-268EF0EB5C0D

Device     Start         End     Sectors  Size Type
/dev/sdb1   2048 11721045134 11721043087  5,5T Linux filesystem


Disk /dev/sda: 111,8 GiB, 120034123776 bytes, 234441648 sectors
Disk model: KINGSTON SA400S3
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa43e61ef

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048  41281535  41279488 19,7G 83 Linux
/dev/sda2        41283582 234440703 193157122 92,1G  5 Extended
/dev/sda5        41283584  55691263  14407680  6,9G 83 Linux
/dev/sda6        55693312  64081919   8388608    4G 82 Linux swap / Solaris
/dev/sda7        72466432  75040767   2574336  1,2G 83 Linux
/dev/sda8        75042816 207110143 132067328   63G 83 Linux
/dev/sda9       207112192 234440703  27328512   13G 83 Linux
I would now like to move (as in the picture) space, specifically from /dev/sda2 to /dev/sda1 .

Although I had booted Gparted via a stick, I have not managed to increase sda1, or shrink sda2 beforehand to gain space.

Would anyone have a step by step guide for me!!!?

Many thanks & greetings
SB
Attached Thumbnails
Click image for larger version

Name:	resize_enlarde_boot_partition.JPG
Views:	222
Size:	95.5 KB
ID:	37790  
 
Old 11-30-2021, 08:57 AM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
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
 
1 members found this post helpful.
Old 11-30-2021, 10:51 AM   #3
Superblond
LQ Newbie
 
Registered: Dec 2020
Posts: 23

Original Poster
Rep: Reputation: Disabled
Lightbulb

Quote:
Originally Posted by HappyTux View Post
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?

Thanks again
SB
 
Old 11-30-2021, 12:05 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,776

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
/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.

Last edited by michaelk; 11-30-2021 at 12:06 PM.
 
Old 11-30-2021, 12:10 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,561

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
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.

https://gparted.org/display-doc.php%...%3Dhelp-manual
 
Old 11-30-2021, 12:44 PM   #6
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Superblond View Post
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?

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.

https://askubuntu.com/questions/1261...ize-partitions

Edit: oops beaten to it for the gparted usage, should read all the replies before posting.

Last edited by HappyTux; 11-30-2021 at 12:46 PM.
 
Old 11-30-2021, 03:47 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,148

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
Note the procedure for moving the extended partition in post #5 should be followed, in preference to that in post #4.
 
Old 11-30-2021, 04:21 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,776

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
Quote:
Originally Posted by syg00 View Post
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.
 
Old 11-30-2021, 06:54 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,386

Rep: Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594Reputation: 1594
You will need to unmount and swapoff partitions within sda2 before moving/resizing partitions.
 
Old 11-30-2021, 07:19 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,148

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
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.

Last edited by syg00; 11-30-2021 at 07:20 PM.
 
1 members found this post helpful.
Old 11-30-2021, 07:58 PM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,776

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
Ok, I will concede...
 
Old 12-01-2021, 06:30 PM   #12
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,868
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
Quote:
Originally Posted by Superblond View Post
Thx HappyTux for that fast & useful answer!

I followed your advice and found around 6 GB of 'trash' in folders...
Note for when this happens next time there is a simplified use of du available called ncdu. Give it a try!
 
Old 12-02-2021, 10:36 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
You're not using LVM = Logical Volume Management here? Why not?
 
  


Reply

Tags
boot, partition, resize, root partition



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help removing free space to create Raw free space nightmare55 Linux - Newbie 11 10-01-2009 03:07 AM
No free space to install but there is free space? HellBound Linux - Laptop and Netbook 6 01-23-2009 09:51 AM
Free Space not being used, resize resierfs partition? gbkyle Linux - General 1 03-07-2005 04:06 AM
Not enough free space on hard drive with 50g of free space??? auoq SUSE / openSUSE 5 10-13-2004 08:21 PM
Formating free space: WinXP pro and RH9 dualboot with free space on 3rd drive Vermicious Linux - General 2 03-22-2004 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration