Friday, March 6, 2026

Another LVs reconfiguration on ArchLinux as of 03/07/2026

UPDATE as of 03/12/2026

See also Running Archinstall and Post installation LVs reconfiguration step via remote SSH connection

END UPDATE

Create root and home LVs as suggested by system during arch-install run-time . In general, we follow approach proposed in https://www.dwarmstrong.org/install-lmde-with-custom-lvm-luks/ a while ago for LMDE 6. Upon completion drop to root's shell and update default LV's layout as shown below ( just for instance)

root~# lsblk -f

root~# vgs

root~# lvs

========================
Now we resize home LV
========================
root~# umount /mnt/home
root~# lvresize -L 15G --resizefs ArchinstallVg/home
========================
Now we resize root LV
========================
root~# lvresize -L 41G --resizefs ArchinstallVg/root
=======================================
Create varpool LV with ext4 filesystem
=======================================
root~# lvcreate -L 32G ArchinstallVg -n varpool
root~# mkfs.ext4 /dev/ArchinstallVg/varpool
 

===============================
Perform mounts of LVs as follows

===============================
root~# mount /dev/ArchinstallVg/root  /mnt/root/
root~# mount /dev/ArchinstallVg/home  /mnt/home/  

root~# mount /dev/ArchinstallVg/varpool   /mnt/var/

=================================================
Move the contents of /var from the root LV to the new varpool's  LV:
=================================================
root~# mv /mnt/root/var/* /mnt/var
 

======================
Update fstab
======================
Create an entry for /var in /mnt/root/etc/fstab:

root~# echo "/dev/mapper/ArchinstallVg-varpool /var ext4  defaults 0 2" >> /mnt/root/etc/fstab

Another way is to run :

# genfstab -U /mnt > /mnt/root/etc/fstab

All folders should be mounted on corresponding /dev/ArchinstallVg/vol-name  devices, otherwise system would fail to reboot

======================
Unmount folders below
======================

root~# umount /mnt/var
root~# umount /mnt/root

root~# umount /mnt/home

root@archiso ~ # arch-chroot /mnt

====================================

Make sure that lvm2 goes ahead of filesystems

====================================

[root@archiso /]# cat /etc/mkinitcpio.conf | grep HOOKS

# HOOKS

# This is the most important setting in this file.  The HOOKS control the

# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for

#    HOOKS=(base)

#    HOOKS=(base udev autodetect microcode modconf block filesystems fsck)

#    HOOKS=(base udev microcode modconf block filesystems fsck)

#    HOOKS=(base udev microcode modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)

#    HOOKS=(base udev microcode modconf block lvm2 filesystems fsck)

#    HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole sd-encrypt block filesystems fsck)

HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont lvm2 block filesystems fsck)

[root@archiso /]# mkinitcpio -P

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'

==> Using default configuration file: '/etc/mkinitcpio.conf'

  -> -k /boot/vmlinuz-linux -g /boot/initramfs-linux.img

==> Starting build: '6.19.6-arch1-1'

  -> Running build hook: [base]

  -> Running build hook: [udev]

  -> Running build hook: [autodetect]

  -> Running build hook: [microcode]

  -> Running build hook: [modconf]

  -> Running build hook: [kms]

  -> Running build hook: [keyboard]

  -> Running build hook: [keymap]

  -> Running build hook: [consolefont]

  -> Running build hook: [lvm2]

  -> Running build hook: [block]

  -> Running build hook: [filesystems]

  -> Running build hook: [fsck]

==> Generating module dependencies

==> Creating zstd-compressed initcpio image: '/boot/initramfs-linux.img'

  -> Early uncompressed CPIO image generation successful

==> Initcpio image generation successful

# exit

and reboot

root~# reboot

ArchinstallVg may be potentially spread across different drives

 



No comments:

Post a Comment