Resize ManjaroVG-ManjaroRoot the proper way

Hi. (@ admins, pls move this thread to a category more fitting if you deem this displaced)

I cannot update Manjaro anymore since this ran out of space:

/dev/mapper/ManjaroVG-ManjaroRoot

To be precise:

Filesystem                         Size  Used Avail Use% Mounted on
dev                                3.9G     0  3.9G   0% /dev
run                                3.9G  1.2M  3.9G   1% /run
/dev/mapper/ManjaroVG-ManjaroRoot   29G   26G  2.2G  92% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              4.0M     0  4.0M   0% /sys/fs/cgroup
tmpfs                              3.9G   50M  3.9G   2% /tmp
/dev/sda1                          184M  149M   26M  86% /boot
/dev/mapper/ManjaroVG-ManjaroHome  881G  625G  212G  75% /home
tmpfs                              789M   68K  789M   1% /run/user/1000

So ManjaroVG-ManjaroRoot is at 92% which makes further updates impossible.

Time to resize. I found a tutorial (which I am not allowed to link here) on lvresize and resize2fs. It says it’s mandatory to first bring the system down to init 1. This fails when being logged in as a regular user, then su and then go out of /home with cd /

I guess my question is: How to properly resize ManjaroVG-ManjaroRoot the Manjaro way?
Or: How to sidestep desktop manager and login just via terminal so I don’t start all user bound processes that might be affected when resizing the harddrive?

(Regarding the latter question: I might be totally wrong with my notion on how to approach this.)

I think as soon as I have terminal only access I can manage to do the job (lvresize and resize2fs) which I’d happily report here.

Thanks!!

can you try this

df -Th
sudo pacman -Sc
df -Th  

I just found out that, quote…
“just hold “Ctrl” and “Alt” keys and then one of the function keys at the top of your keyboard once the system is booting past the grub screen. F1 through F6 will get you a command prompt and F7 will get you back to your GUI.”

(Sorry, no source --I am not allowed to post links.)

And you can do CTRL+ALT+F1-7 at any point it seems.

This is it!! So now I can start resizing (using lvresize and resize2fs). But any hints are still very much welcomed.

Yes, I cleared the cache already. So I am at the upper limit without any cached packages. Thanks for the hint.

perhaps this
or this
or … the whole article
could help you solve your problem.

Doing it “from the outside” - via a booted live system to access your installation might make it easier.
I have never done this - but LVM is supposed to be … flexible
in regard to relatively easily adjusting the sizes of the different logical volumes.

Any (good) guide on adjusting the sizes of logical volumes should do - as this is not distribution specific.

Unfortunately this doesn’t work. In order to shrink ManjaroVG-ManjaroHome and extend ManjaroVG-ManjaroRoot you need to unmount / and /home which is of course not possible. I am using ext4 which is reported to have “on-line resizing” capabilities. (Means, possible to do underlying changes while being mounted.) But this is not correct as I get:

> resize2fs /dev/mapper/ManjaroVG-ManjaroHome 871G
Filesystem at /dev/mapper/ManjaroVG-ManjaroHome is mounted to /home                 ; on-line resizing required
resize2fs: On-line shrinking not supported

So that’s that. Does this mean, up to a point Manjaro cannot be updated anymore and must be completely re-installed??? Cannot imagine. So what’s the approach here?

Thanks!

@Nachlese Just noticed your post. Your sources point out --resizefs with lvresize. I’ll give it a try!

… do it “from the outside” then
boot a live system and access your system from there …
to adjust the size of your volumes

No

new post instead of an edit

the logical procedure (to me) would be:

first shrink a logical volume inside the PV

which contains the logical volumes …
(since this is all the space you have - all you can do is re-distribute the allocated space among the volumes inside the PV)

to do this
you first shrink the filesystem size - then adjust the volume (partition) size to that
for one logical volume

then
you could use that space to extend the size of another lvm member
by first increasing it’s (logical) size
and then extending the file system within it to that new size

It’s done. And here are the steps…

A) Get hold of a Live-Linux (Live-CD/DVD/USB-Stick)
B) (Optionally) Decrypt your HDD
C) Unmount the logical volumes ManjaroRoot and ManjaroHome
D) Shrink the logical volume and file system of ManjaroHome
E) Increase the logical volume and file system of ManjaroRoot

I hopefully explain this now in a super easy and constructive way.

A) Get hold of a Live-Linux (Live-CD/DVD/USB-Stick)

In order to alter / (system root) and /home they must be unmounted. As far as I know, it’s only possible to have these critical portions unmounted when the OS on top of it is not running. So as @Nachlese pointed out, you need to access the HDD and it’s logical volumes from the outside. And a Live-Linux via USB flash drive / stick is the easiest way to do so. For instance: 4MLinux, Tail, Knoppix, etc.

B) Once the Live-Linux of your choice (Knoppix in my case) is booted from stick, you’re ready to access the now passive Manjaro drive. First thing you may need to do is decrypt the hard drive.

> sudo cryptsetup luksOpen /dev/sdXX myManjaroHDD

Replace XX with the fitting number for your drive. (sudo fdisk -l)
Of course, you may have a different encryption system set up.

C) Unmount the logical volumes ManjaroRoot and ManjaroHome

In case the Manjaro volumes got mounted automatically by the Live-Linux you need to unmount them again.

> sudo umount /dev/mapper/ManjaroVG-ManjaroRoot
> sudo umount /dev/mapper/ManjaroVG-ManjaroHome

D) Shrink the logical volume and file system of ManjaroHome

To make it easy and safe, gather the names and sizes of the logical volumes:

> sudo lvscan
  ACTIVE            '/dev/ManjaroVG/ManjaroRoot' [<29,30 GiB] inherit
  ACTIVE            '/dev/ManjaroVG/ManjaroSwap' [<7,73 GiB] inherit
  ACTIVE            '/dev/ManjaroVG/ManjaroHome' [<894,30 GiB] inherit

(You can easily copy the names now, and check the numbers afterwards.)

Time to shrink the logical volume (lvresize), check and resize the file system of ManjaroHome:

> sudo lvresize -L -20G ManjaroVG/ManjaroHome
> sudo e2fsck -f /dev/ManjaroVG/ManjaroHome
> sudo resize2fs /dev/ManjaroVG/ManjaroHome

Here e2fsck told me there is some space to optimize. I am super lazy so I canceled e2fsck (CTRL-C) and reissued with:

> sudo e2fsck -fy /dev/ManjaroVG/ManjaroHome

… to approve all optimisations. You can do this at a later point also.

E) Increase the logical volume and file system of ManjaroRoot

> sudo lvresize -L +20G ManjaroVG/ManjaroRoot
> sudo e2fsck -f /dev/ManjaroVG/ManjaroRoot
> sudo resize2fs /dev/ManjaroVG/ManjaroRoot

Here e2fsck was mandatory. And it went smoothly. Time to check the alterations:

> sudo lvscan
  ACTIVE            '/dev/ManjaroVG/ManjaroRoot' [<49,30 GiB] inherit
  ACTIVE            '/dev/ManjaroVG/ManjaroSwap' [<7,73 GiB] inherit
  ACTIVE            '/dev/ManjaroVG/ManjaroHome' [<874,30 GiB] inherit

And it’s possible again to update Manjaro since /dev/ManjaroVG/ManjaroRoot has plenty of space again.

Some notes:

  • Thanks to @Nachlese
  • Plz don’t blindly copy/paste what you see here. Your set up may differ in a way that requires thinking and re-assessing the situation. For instance my system has ext4 on ManjaroRoot and ManjaroHome.
  • I cannot remember the install process of Manjaro which for me was like 7 or 8 years ago. But I think I didn’t set up ManjaroRoot to be 29GB only. If there was an initial suggestion, I am sure I would have doubled that number. I guess, chances are there are or will be plenty of Manjaro users that lack admin skills (as I do) and who WILL run into this problem sooner or later. I am somewhat puzzled not to find a tutorial on this important matter in this forum yet. And as a final and super heretical note, in order to successfully run and update Manjaro for years at one point you need another Linux to fix Manjaro’s initial setup.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.