Resize a root partition to make room for a zfs partition for lxd containers?
Linux - NewbieThis 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
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.
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).
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.