There is no more space in root filesystem. How could I increase the size?
- Vous devez vous identifier ou créer un compte pour écrire des commentaires
Hello everyone,
I am having a bit of an issue with my Trisquel system. My root file system appears to be out of space. However, my `home` directory shows around 297.4 Gigabyte (GB) of free space.
How can I expand the amount of space on the root file system?
How is your system partitioned? The output of "lsblk --fs" should provide the useful information.
Indeed. If /home is on an XFS filesystem, another large-enough disk will be needed, because XFS cannot be shrunk, only deleted.
`lsblk --fs` returns the following:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1
│
├─sda2
│ vfat FAT32 BA36-E39B 511.7M 0% /boot/efi
├─sda3
│ ext4 1.0 ea98336a-83c5-4c95-83f7-3786a9d0e409 1.3G 10% /boot
└─sda4
crypto 2 17bc0f8d-1316-4deb-ae0b-f50cb16ca241
└─sda4_crypt
LVM2_m LVM2 1NWtsQ-LXoL-UVgR-S3Q8-qL3S-BfN7-PvzZ29
├─vgtrisquel-root
│ ext4 1.0 2d164f68-c84f-4173-a786-8598d999b6da 245.4M 94% /
├─vgtrisquel-swap_1
│ swap 1 b4313d31-1405-4c28-9ed3-f50f069ccc68 [SWAP]
└─vgtrisquel-home
ext4 1.0 55030d2c-b19c-48ce-bd98-849e5c9c06ae 276.9G 30% /home
Thank you so much for all of your help.
I'm not the most familiar with this. I believe the main partition is `ext4` but am somewhat unfamiliar with `xfs`.
By definition, the root partition is the one whose mount point (last column of lsblk's output) is /. The filesystem type (second column of lsblk's output) where your /home is ext4, not XFS. Ext4 can be shrunk. Moreover, LVM manages your partition. That is supposed to ease the operation: no need to use a live system, I believe. Nevertheless, I have never learnt to use LVM. You may want to wait for the help of somebody knowledgeable about LVM.
EDIT: here he is: Avron! :-)
I would not do it on the mounted disk. I used the live usb to resize. Another thing that helps is to remove unneeded kernels and other packages:
apt autoremove
Before attempting to resize you should back up your important files.
To resize the filesystem you will probably have to do a fsck first and the system will tell you to do so.
The mount command should tell you what is mounted:
mount
fsck.ext4 -f /dev/vgtrisquel/root
fsck.ext4 -f /dev/vgtrisquel/home
Then you can resize the home filesystem and lvm volume
If you want increase your root by 30G, you may shrink your home by 30G with the command, where /dev/vgtrisquel/home is your home volume and your /dev/sda4_crypt is your physical volume:
lvresize --resizefs -L -30G /dev/vgtrisquel/home /dev/sda4_crypt
And then resize the root.
lvresize --resizefs -L +30G /dev/vgtrisquel/root /dev/sda4_crypt
That's at least how I do it. I think according to the documentation the physical volume is also required. That's without opening the crypt device which I if you follow Avron's post you will know how to do.
You need to boot on a live USB.
Then, in a terminal:
sudo cryptsetup luksOpen /dev/sda4 sda4_crypt
sudo lvresize -L -10G --resize-fs vgtrisquel/home
sudo lvresize -l +100%FREE --resize-fs vgtrisquel/root
After that, you can ask to reboot. I used such commands several times and never had any problem but updating your backup of your home volume before doing this is a good idea.
The first command opens the encrypted physical volume.
The second command reduces your home logical volume by 10G (-10G) and resizes the file system accordingly.
The third command enlarges your root logical volume to take all the unused space. lvresize -L +10G --resize-fs vgtrisquel/root would probably do the same, I just selected the command to take all free space in case there would be some extra unused space.
vgtrisquel is called the "volume group" (hence "vg" I guess) and root and home are the "logical volumes" in it.
I rechecked the commands from https://wiki.archlinux.org/title/LVM#Resizing_the_logical_volume_and_file_system_in_one_go
Just out of the oven:
https://trisquel.info/en/wiki/how-resize-trisquels-default-encrypted-partitions
Please check it, test it and improve it at will.
Regards.
That is a nice manual you wrote here: thank you!
However, doesn't Avron and eric23's suggestion to use lvresize --resizefs work? It is simpler: one single command to resize (extend or reduce) the logical volume and the underlying filesystem.
I'll let the community improve it in ways they know are better.
Maybe even add some images for it =)