LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-13-2019, 04:24 PM   #1
cjspizz
LQ Newbie
 
Registered: Nov 2018
Location: Rock hurtling through space-time
Distribution: Linux Mint 20.3 "Una"
Posts: 21

Rep: Reputation: 2
Question How to expand /[root] with adjacent (preceding) free space


About 4 months ago, I setup a Win 10/Mint 19 dual-boot and haven't booted into Windows since! Unfortunately, my 30GB root partition is filling up (65% used), so I'd like to expand it.

As you can see below, I carved out another 19GB of free space between /dev/sdc1 and /dev/sdc2 that is in front of the root partition. Here's a visual, in case it helps (also attached):

https://i.ibb.co/ScBMGT4/root-expand...located-01.png

Here's my full system partitioning:

/dev/sda [WDC SATA II, 1TB, GPT Partitioning]
  • /dev/sda1 (Microsoft reserved partition, 134MB)
  • /dev/sda2 (V: Misc, 950GB)
  • /dev/sda3 (/media/cjspizz/Mint Snapshots, 50GB)

/dev/sdb [Kingston SSD, 120GB, MBR Partitioning]
  • /dev/sdb1 (System Reserved, 367MB) [boot]
  • /dev/sdb2 (C: Windows 10, 119GB)
  • /dev/sdb3 (Win Recovery, 472MB)
  • free space (1.5MB)

/dev/sdc [Seagate SATA III 2TB, MBR Partitioning]
  • /dev/sdc1 (S: Data, 1.8TB)
  • free space (19GB)
  • /dev/sdc2 (/[root], 31GB)
  • /dev/sdc3 (swap, 8.2GB)
  • /dev/sdc4 (/home, 176GB)

I booted into a Linux Mint Live USB stick to use GParted to slide the left edge of /dev/sdc2 leftward over the new adjacent free space. When I clicked to apply the changes, I got the following warning:

Quote:
Moving a partition might cause your operating system to fail to boot. You have queued an operation to move the start sector of partition /dev/sdc2. Failure to boot is most likely to occur if you move the GNU/Linux partition containing /boot, or if you move the Windows system partition C:.
I cancelled the operation.

Then I slid the whole /dev/sdc2 partition left, so it would be in front of the adjacent free space. Then slid the right edge of /dev/sdc2 rightward over the adjacent free space but got the same warning.

I'm thinking I can ignore the warning, because the boot sector (and grub2) are in /dev/sdb1. But I didn't want to risk it.

I need help figuring out how to get this done (or whether it's even possible). Any and all advice is appreciated. Thanks!
Attached Thumbnails
Click image for larger version

Name:	root expand_gparted _dev_sdc [unallocated]_01.jpg
Views:	20
Size:	23.4 KB
ID:	29793  
 
Old 02-13-2019, 05:00 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
well for one you put or that install did that stupid put the swap in the middle of the root and /home/

first I'd delete whatever is in /tmp if more room is still needed, then, I'd log in root user, gets you off the home partition, delete swap, move home over almost all of the way up against the root, leaving some for root partition, then move the back end of home to make that left over for swap, (id not even have a swap), but....

then open fstab and update it to reflect the new UUIDs mount -a and watch a movie while its moving things around. when the movie is done or gparted is done then I'd reboot into a usb Linux live OS with gparted, then move that bit I left for root into root then reboot again into my system.

or just do all of it using a Live USB Linux OS with gparted.

Ignore the warnings because it does not know what you are doing, I just did this same thing, basically, well I deleted a bunch of partitions in usb OS and reinstalled 1 distro so far, I was hitting ignore all the way through the process, and now I am up and running again with a fresh install...

Last edited by BW-userx; 02-13-2019 at 05:10 PM.
 
1 members found this post helpful.
Old 02-13-2019, 05:53 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Quote:
because the boot sector (and grub2) are in /dev/sdb1.
If the information you posted is correct, sdb1 would be a windows filesystem and I doubt that Grub files would be there. Your post indicates that drive (sdb) is an msdos/MBR drive. If you had an EFI install, you would have some Mint EFI files and grub files on a vfat partition but you don't seem to have that. Windows requires EFI on a GPT drive. Post the output of the command: sudo parted -l for more detailed information.

The warning message you see is almost always shown when moving a partition to the left as you will be moving boot files. Probably the safest thing to do is after you move to the left with GParted is to use chroot to get into the Mint partition and run: sudo update-grub.

When you boot, are you booting Mint from the windows bootloader or windows from the Mint/Grub bootloader? Is your 1TB drive (sda) just a data partition? Do you know which drive has Grub in the MBR?
 
1 members found this post helpful.
Old 02-13-2019, 06:12 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
if you are pushing the root to the left to take up that space and mbr boot, I've done this before as well, I was surprised how easy it was, I shrank my windows partition on the right some, and moved root over to the left. rebooted, as the partitions where not destroyed and recreated, the UUID stays the same. I had no issues with it.
 
Old 02-13-2019, 06:28 PM   #5
cjspizz
LQ Newbie
 
Registered: Nov 2018
Location: Rock hurtling through space-time
Distribution: Linux Mint 20.3 "Una"
Posts: 21

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by yancek View Post
When you boot, are you booting Mint from the windows bootloader or windows from the Mint/Grub bootloader?
The Mint/Grub bootloader.

Quote:
Originally Posted by yancek View Post
Is your 1TB drive (sda) just a data partition?
Yes.

Quote:
Originally Posted by yancek View Post
Do you know which drive has Grub in the MBR?
No.

Quote:
Originally Posted by yancek View Post
Post the output of the command: sudo parted -l for more detailed information.
Model: ATA WDC WD1001FALS-0 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 17.4kB 134MB 134MB Microsoft reserved partition msftres
2 135MB 950GB 950GB ntfs Basic data partition msftdata
3 950GB 1000GB 50.0GB ext4 Mint Snapshots


Model: ATA KINGSTON SV300S3 (scsi)
Disk /dev/sdb: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 368MB 367MB primary ntfs boot
2 368MB 120GB 119GB primary ntfs
3 120GB 120GB 472MB primary ntfs diag


Model: ATA ST2000DM001-1ER1 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 1767GB 1767GB primary ntfs
2 1786GB 1816GB 30.7GB primary ext4
3 1816GB 1825GB 8193MB primary linux-swap(v1)
4 1825GB 2000GB 176GB primary ext4
 
Old 02-13-2019, 07:15 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Ignore the warning. It was particularly relevant with classic grub if you were moving /boot. Not really an issue these days for Linux - Windows on the other hand ... :shrug: (I know, not an issue here).

gparted liveCD is excellent for these things - moving left is always a concern (and slow) because all the filesystem metadata has to move. I prefer to slide the entire partition first (as you mentioned later) then apply that. Let it finish, then expand it to the right - apply that, it will be quick.
At that point you can destroy the backup you took before you started.

As an aside, 30G should be plenty for the root - find out what the underlying problem is with space consumption rather than attacking the symptom.

Last edited by syg00; 02-13-2019 at 07:16 PM.
 
1 members found this post helpful.
Old 02-13-2019, 07:30 PM   #7
cjspizz
LQ Newbie
 
Registered: Nov 2018
Location: Rock hurtling through space-time
Distribution: Linux Mint 20.3 "Una"
Posts: 21

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by syg00 View Post
As an aside, 30G should be plenty for the root - find out what the underlying problem is with space consumption rather than attacking the symptom.
That's what I thought! All the research I did before the install said 20GB was plenty, and anything extra was icing on the cake. I figured 30GBs might even be excessive but went for it any way.

Any suggestions for figuring out what's going on in root? Any well-known culprits for clogging root?
 
Old 02-13-2019, 07:40 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
First suspect with current Mint would be snapshots, but you seem to have that covered. Try this and see if it give any hints - will take a while, just let it run.
Code:
sudo du / -xh | sort -hr | head -n 20
 
Old 02-13-2019, 11:11 PM   #9
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by cjspizz View Post
Then I slid the whole /dev/sdc2 partition left, so it would be in front of the adjacent free space. Then slid the right edge of /dev/sdc2 rightward over the adjacent free space but got the same warning.

I'm thinking I can ignore the warning, because the boot sector (and grub2) are in /dev/sdb1. But I didn't want to risk it.
And well you did.
The only way moving the START of a partition is by using a full backup and restore:
Quote:
1. Backup your complete root (/) partition
2. From the live fs remove /dev/sdc2 partition
3. Create a new sdc2 partition, incorporating the free space
4. Make a fs ON that partition
5. Restore the backup'ed data into that partition
6. Optionally, dependant on the boot manager, restore the bootable data
7. Try to reboot TO this new root partition
The problem is that all the "offset" block numbers IN the file system are relative to the first block in that partition (the "super block") and you're moving the start would put that block somewhere in the middle. So a new super block has to be created (with mkfs) and that will empty out the whole partition.
 
1 members found this post helpful.
Old 02-13-2019, 11:13 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Try it. It works.
 
Old 02-16-2019, 07:03 PM   #11
cjspizz
LQ Newbie
 
Registered: Nov 2018
Location: Rock hurtling through space-time
Distribution: Linux Mint 20.3 "Una"
Posts: 21

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by ehartman View Post
4. Make a fs ON that partition
Sorry for the dumb question, but what's "fs"?
 
Old 02-17-2019, 09:54 AM   #12
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by cjspizz View Post
Sorry for the dumb question, but what's "fs"?
File System, the organisation of (meta)data on the partition, disk or volume (like the directory structure, some form of "superblock" and allocation info. etc).
Well known fs'es are ext? (ext3 or ext4), btrfs (B-tree fs) or for Windows: fat (file allocation table, comes in several variations) or ntfs (original: Windows/NT fs).
See "man mkfs" for some more information).
 
1 members found this post helpful.
Old 02-17-2019, 10:34 AM   #13
cjspizz
LQ Newbie
 
Registered: Nov 2018
Location: Rock hurtling through space-time
Distribution: Linux Mint 20.3 "Una"
Posts: 21

Original Poster
Rep: Reputation: 2
I think I'm following what you're saying. Based on my understanding, here's my plan:
  1. Boot into Clonezilla live
  2. Backup my complete root (/) partition
  3. Boot into GParted live
  4. Remove /dev/sdc2 partition
  5. Create a new sdc2 root partition, incorporating the free space
  6. Make a fs on the new sdc2 root partition
  7. Boot into Clonezilla live
  8. Restore the backed up data into the new sdc2 root partition
  9. Try booting into Mint
  10. If Mint won't boot, boot into Super Grub2 to fix boot problems
  11. Boot into Mint
Does that make sense and follow what you're suggesting? Is there anything else I'm missing?
 
Old 02-19-2019, 06:02 AM   #14
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
Quote:
Originally Posted by cjspizz View Post
About 4 months ago, I setup a Win 10/Mint 19 dual-boot and haven't booted into Windows since! Unfortunately, my 30GB root partition is filling up (65% used), so I'd like to expand it.
You could mount that partition somewhere on the root tree where it could be useful, but that doesn't expand root in general, it just adds that space into the root tree.

If you have a good overview of the uses space on root, you could add that 19gb of free space into somewhere in the root tree where it can be well used and move the data from the root partition to the same area of the tree after mounting that partition to the same place under the root tree where it can be useful.

Just remember to edit the fstab also.

Let's say somewhere on /usr could be useful.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] I need to increase the size of /var - adjacent to an NTFS partition Milo4t Mageia 8 10-23-2018 03:21 AM
[SOLVED] force to grep adjacent words udiubu Linux - Newbie 2 07-04-2018 12:30 PM
Why does open office put lines into adjacent cell when I am splitting one cell 1sweetwater! Linux - Software 1 12-03-2014 01:36 PM
Want to merge partitions, but they are not adjacent westcoastlinux Linux - Hardware 3 09-17-2011 12:28 PM
icewm, how to go to adjacent workspace when window moving at the edge ? frenchn00b Linux - Desktop 13 01-19-2008 07:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:28 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