LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-18-2020, 12:31 PM   #1
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Resize a root partition to make room for a zfs partition for lxd containers?


I've recently been looking at zfs a bit for my lxd containers and I'm thinking the COW feature would save me a ton of space on my ssd. Currently running 10 or 11 containers in dir mode. My server has a 120gb ssd with all but 2gb for the root partition. 2gb swap I believe.

I'd like to reduce my root partition down to 20gb or so and make a new partition which will ultimately be zfs to hold my containers. is this feasible or even easy to do via live boot / chroot. Or would it be easier to just wipe it out and reinstall properly? I have another machine that can hold my containers for the time being (I love lxd for it's network ability).
 
Old 03-18-2020, 01:05 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,510

Rep: Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491
You would need to use a live cd as you can't resize a mounted partition. Should be fairly easy with GParted if you have that on a live cd. I don't use containers so I'm not sure what effect that would have.
 
Old 03-18-2020, 03:51 PM   #3
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Quote:
Or would it be easier to just wipe it out and reinstall properly?
Yes.
You don't state what filesystem you currently have on your root partition. xfs cannot be resized; ext* can be using a livecd as noted above. However, resizing may change your root partition uuid which would then potentially require changing fstab and grub to accommodate the new uuid - see where I'm going with this. It's certainly doable if you are careful but I think you are better off just doing a reinstall.
 
Old 03-18-2020, 04:55 PM   #4
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
However, resizing may change your root partition uuid which would then potentially require changing fstab and grub to accommodate the new uuid
This is wrong in both cases. Shrinking an ext4 filesystem won't result in changing its UUID.

For an xfs filesystem you will have to format a new xfs filesystem as xfs cannot be shrunk. However you can easily set the UUID of the new filesystem to the old UUID with

Code:
$ xfs_admin  -U old-uuid /dev/sdxx
You can easily get the old UUID string from fstab or grub.cfg so you don't have to change those files. It is a 1-2 minute fix to set the UUID to the old one already in fstab and grub.cfg.

Quote:
- see where I'm going with this.
Actually I don't. Since your 'problem' doesn't really exist there is no need to idiotically do a unnecessary re-install.
 
Old 03-18-2020, 05:34 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
And it should be noted that you can also resize (even shrink) partitions of an active system - including the root.
It's not something I encourage, and if you have to ask how, don't even contemplate it. LiveCD are a godsend for things like this.

Re-install is for when you properly screw things up - which is always a possibility when playing with partitions.
 
Old 03-18-2020, 06:09 PM   #6
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Original Poster
Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Forgot to mention ext4. I'll keep in mind. Probably do a reinstall. As if I screw it up ill end up doing that anyway.
 
Old 03-19-2020, 05:20 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Quote:
Originally Posted by jmgibson1981 View Post
Probably do a reinstall. As if I screw it up ill end up doing that anyway.
Better to make the attempt - that way you'll learn something. If you just re-install, next time you'll be asking again.
 
Old 03-19-2020, 05:50 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by syg00 View Post
And it should be noted that you can also resize (even shrink) partitions of an active system
Shrink?? Really?? Is that something new?
 
Old 03-19-2020, 05:59 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
gparted won't let you do it - think non-GUI.
 
Old 03-20-2020, 05:29 PM   #10
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Original Poster
Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
Good point. I'll get into it sunday probably if i do it..
 
  


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
Systemd dependencies LXD on ZFS on LUKS (on network) jesusangel Linux - Server 0 12-13-2019 07:44 PM
LXer: Linux Containers (LXD) as an Alternative to VirtualBox for WordPress Development LXer Syndicated Linux News 0 04-17-2016 02:22 PM
LXer: Will LXD Containers on Ubuntu Revolutionize Open Source Virtualization? LXer Syndicated Linux News 0 11-09-2015 06:03 PM
LXer: Canonical pushes LXD, its new mysterious drug for Linux containers LXer Syndicated Linux News 0 11-06-2014 06:30 AM
LXer: How-To Resize Your Windows Partition To Make Room For Linux LXer Syndicated Linux News 0 12-15-2005 09:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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