# Add space to the root volume

**URL:** <https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851>\
**Category:** Rocky Linux Help & Support\
**Created:** [July 28, 2023, 3:23pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851 "2023-07-28T15:23:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://forums.rockylinux.org/u/chlowden)\
**Post date:** [July 28, 2023, 3:23pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/1 "2023-07-28T15:23:22Z")

</div>

Hello  
I have a 75GB  
/dev/rl/root  
volume that is constantly full.

I also have 700GB of free space on /dev/rl/home

Is it possible to move 100GB of free space from /dev/rl/home to /dev/rl/root without erasing all the data ?

Any thoughts are most welcome.  
Thank you

---

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [July 28, 2023, 3:32pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/2 "2023-07-28T15:32:49Z")

</div>

It depends on what your filesystem is. If it is xfs, then no, you cannot shrink it. If it is ext4 or ext3, then yes you can shrink it.

---

<div class="post-metadata">

**Author:** ![Jil](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/jil/32/1089_2.png) [@Jil](https://forums.rockylinux.org/u/Jil)\
**Post date:** [July 28, 2023, 4:31pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/3 "2023-07-28T16:31:57Z")

</div>

What of ZFS file system ? Can it be extended?

Please show us how to extend in ext4 or ext3 for learning purposes.

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://forums.rockylinux.org/u/chlowden)\
**Post date:** [July 28, 2023, 5:41pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/4 "2023-07-28T17:41:14Z")

</div>

Both are xfs on my machine … that is rather disappointing. Thank you for your confirmation.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [July 28, 2023, 8:42pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/5 "2023-07-28T20:42:29Z")

</div>

What is consuming space on `/` ? (You could run something like `du -d 2 -hx /` to spot the big subdirs.)

You could create a subdirectory under `/home` that is nobody’s _home directory_.  
Then move content of some big one to that new dir.  
Finally, _bind mount_ the new dir to where the data was originally. (That way you don’t have to tell services tha their data is physically elsewhere.)

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://forums.rockylinux.org/u/chlowden)\
**Post date:** [July 29, 2023, 9:50am UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/6 "2023-07-29T09:50:22Z")

</div>

My machines are desktop Rocky stations and I install lots of apps etc. Snap & flatpak take up so much space

> [@Managing root partition on desktop](https://forums.rockylinux.org/t/managing-root-partition-on-desktop/9572/12):
>
> Snap and Flatpak take up way more room than I think make them worth it. It is like each app takes up nearly a whole embedded OS’s worth of disk space. Certainly try to use the “native” RPM packages for apps when you can using snap or flatpak only for apps you cannot find as RPMs. And then stick with one or the other, not both snap and flatpak. One could also probably move /var/lib/flatpak to /home and symlink to it there. But only if the flatpak service is not running at the time.

I really don’t want to rebuild my machine due to the time it (as I am sure many of you understand) and I did not really that all the apps etc install to root. The out of the box rocky root format size is 50GB, which is fine for a very specific use cases, but for a desktop usage like mine, the root should be at least 100GBs in my experience.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [July 29, 2023, 1:11pm UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/7 "2023-07-29T13:11:58Z")

</div>

> [@chlowden](#):
>
> The out of the box rocky root format size is 50GB, which is fine for a very specific use cases, but for a desktop usage like mine, the root should be at least 100GBs in my experience.

I’d rather keep the root small (I have usually 24GiB root) and have separate filesystem for flatpaks that is mounted to `/var/lib/flatpak`

If filesystems are not trivial to resize (e.g. they have XFS and are not on LVM volumes) and space allocation is uncertain, then I’d have the “data” filesystem (for snaps, flatpaks, VM images, etc) and _bind mount_ subdirs from there.

> [@Managing root partition on desktop](https://forums.rockylinux.org/t/managing-root-partition-on-desktop/9572/12):
>
> One could also probably move /var/lib/flatpak to /home and symlink to it there. But only if the flatpak service is not running at the time.

Indeed.

1. Stop (flatpak) service that uses a directory
2. Move `/var/lib/flatpak` to other filesystem (that has space, e.g. to `/home/`)
3. Symlink or bind-mount `/home/flatpak` to `/var/lib/flatpak` (I prefer bind mounts)
4. Restart the service

You don’t need to “rebuild” the machine, if you do the above and you don’t have to run flatpaks/snaps/etc while you have a “maintenance break” for the transfers.

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://forums.rockylinux.org/u/chlowden)\
**Post date:** [August 1, 2023, 9:55am UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/8 "2023-08-01T09:55:45Z")

</div>

Thank you for the symlink suggestion. I presume that future OS updates will not affect this suggestion?

---

<div class="post-metadata">

**Author:** ![oscav](https://avatars.discourse-cdn.com/v4/letter/o/eb8c5e/32.png) [@oscav](https://forums.rockylinux.org/u/oscav)\
**Post date:** [August 2, 2023, 7:50am UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/9 "2023-08-02T07:50:44Z")

</div>

This is not a beginner how to. It tells what I did but it’s not a step-by-step guide.

The /home filesystem is large, but at the beginning it does not contain much data.  
So I booted in single user mode, which will let me unmount /home later.  
Used an external usb disk (or a usb stick with enough capacity) for creating a filesystem (any type will do) large enough to store everything you have in /home, copied everything inside /home to that new filesystem (double check that everything was copied and that owner group and permissions were preserved).  
Then unmount /home and remove it’s LV.  
Now, create a smaller LV and build an ext4 filesystem inside, mount it as /home, copy back the contents you saved to the external disk.  
Make sure that /etc/fstab is pointing to the new fs and that the type now is ext4.

And that should be enough.  
You know have enough free space on the vg to enlarge / but even better you can now create a /var fs, which probably is what is causing your / to fill up.  
This will require other boot trick because you can’t let systemd start on boot. If memory serves me you have to add init=/bin/sh to your kernel line. After that the idea is the same, as you now have space on the VG you can create and mount a new ext4 filesystem, name it /var2, copy everything from /var to /var2, remove /var and it’s contents. Create a directory named /var (it will be the mount point).  
Now unmount /var2, go into /etc/inittab and set the new filesystem to be mounted on /var, you can do a mount /var before rebooting just to make sure it is working. If it is just reboot normally.

What I really want is a procedure to convert / from xfs to ext4 ☹

---

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [August 2, 2023, 7:59am UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/10 "2023-08-02T07:59:59Z")

</div>

> [@oscav](#):
>
> What I really want is a procedure to convert / from xfs to ext4 ☹

There are not any conversions between xfs to ext4 that I am aware of. You can convert ext4 to btrfs, since btrfs provides these tools to do that. But this is irrevelant since Red Hat removed btrfs from their distro (but other distros do have it, so just worth mentioning anyway). I believe there was some github project claiming conversions between filesystems, but even that had huge disclaimers for potential data loss. Not worth the risk.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [August 2, 2023, 8:41am UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/11 "2023-08-02T08:41:06Z")

</div>

> [@oscav](#):
>
> So I booted in single user mode, which will let me unmount /home later.

One can also boot with the install media; there (bootloader’s menu) are “troubleshoot” options in addition to the “install” and “test&install”. That way you can run without depending on any filesystem that is in the drive(s).

> [@oscav](#):
>
> What I really want is a procedure to convert / from xfs to ext4 ☹

Essentially the same as with /home: dump data to backup, replace filesystem, and restore.  
There you really need that “external OS” (like the install media); can’t run from the volume that you wipe.

There is also the “hindsight procedure”: never use XFS in the first place and always leave some of the drive unallocated (for “future volumes”).

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://forums.rockylinux.org/u/chlowden)\
**Post date:** [August 4, 2023, 9:50am UTC](https://forums.rockylinux.org/t/add-space-to-the-root-volume/10851/12 "2023-08-04T09:50:14Z")

</div>

Another space hog is NVIDIA. Gigabytes get used up with multiple installs of CUDA and drivers etc. And in my experience, once broken NVIDIA is a real pain to repair.
