I have a laptop with Arch on it, and I sized the root partition too small. Now I want to expand the partition by taking some from the home partition. I will put the details of the specifics below. My question(s) to you is
1) Am I just expanding the root? Or shrinking the home? Or is it both? If both then does order matter? I see several online tuts that sort of do them different ways. So it's confusing to me.
2) Should I follow the arch documentation exactly? It's not like other tuts I've seen which may not be distro specific. Also asking because it mentions things like make a new partition under expand, but never says anything about what to do with the old one. It would be great if you could explain this if the answer is yes.
3) Do I need to update my fstab afterwards?
4) If all goes well, I should still have my data on these partitions right? Obviously I'm backing up just to be sure.
Here are my specific details:
> df -h
Filesystem Size Used Avail Use% Mounted on
dev 7.7G 0 7.7G 0% /dev
run 7.7G 1.2M 7.7G 1% /run
/dev/mapper/archvg-root 9.8G 9.3G 0 100% /
tmpfs 7.7G 723M 7.0G 10% /dev/shm
tmpfs 7.7G 0 7.7G 0% /sys/fs/cgroup
tmpfs 7.7G 16K 7.7G 1% /tmp
/dev/nvme0n1p1 749M 62M 688M 9% /boot
/dev/mapper/archvg-home 456G 3.0G 430G 1% /home
tmpfs 1.6G 16K 1.6G 1% /run/user/1000
/dev/fuse 250G 78M 250G 1% /run/user/1000/keybase/kbfs
> lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 477G 0 disk
├─nvme0n1p1 259:1 0 750M 0 part /boot
└─nvme0n1p2 259:2 0 476.2G 0 part
└─archlv 254:0 0 476.2G 0 crypt
├─archvg-swap 254:1 0 2G 0 lvm [SWAP]
├─archvg-root 254:2 0 10G 0 lvm /
└─archvg-home 254:3 0 464.2G 0 lvm /home
> sudo pvdisplay -m
--- Physical volume ---
PV Name /dev/mapper/archlv
VG Name archvg
PV Size 476.20 GiB / not usable <1.32 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 121908
Free PE 0
Allocated PE 121908
PV UUID m11dPA-mPYo-6dLS-mXPF-V1Ww-jXuO-QXfB8e
--- Physical Segments ---
Physical extent 0 to 511:
Logical volume /dev/archvg/swap
Logical extents 0 to 511
Physical extent 512 to 3071:
Logical volume /dev/archvg/root
Logical extents 0 to 2559
Physical extent 3072 to 121907:
Logical volume /dev/archvg/home
Logical extents 0 to 118835
> sudo cat /etc/crypttab
# Configuration for encrypted block devices.
# See crypttab(5) for details.
# NOTE: Do not list your root (/) partition here, it must be set up
# beforehand by the initramfs (/etc/mkinitcpio.conf).
# <name> <device> <password> <options>
# home UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37 /etc/mypassword1
# data1 /dev/sda3 /etc/mypassword2
# data2 /dev/sda5 /etc/cryptfs.key
# swap /dev/sdx4 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
# vol /dev/sdb7 none
> sudo cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# UUID=8ab13737-d7f1-4f2c-b67b-ad15f7374978
/dev/mapper/archvg-root / ext4 rw,relatime 0 1
# UUID=dc591a00-12d4-49fa-a81e-e80fa71e7aca
/dev/mapper/archvg-home /home ext4 rw,relatime 0 2
# UUID=5A10-D12E
/dev/nvme0n1p1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
# UUID=492bf365-32de-4756-86da-7fc335dba3dd
/dev/mapper/archvg-swap none swap defaults,pri=-2 0 0
> findmnt
TARGET SOURCE FSTYPE OPTIONS
/ /dev/mapper/archvg-root
│ ext4 rw,relatime
├─/proc proc proc rw,nosuid,nodev,noexec,relatime
│ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13001
│ └─/proc/sys/fs/binfmt_misc binfmt_misc binfmt_misc rw,relatime
├─/sys sys sysfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/firmware/efi/efivars efivarfs efivarfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup tmpfs tmpfs ro,nosuid,nodev,noexec,mode=755
│ │ ├─/sys/fs/cgroup/unified cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate
│ │ ├─/sys/fs/cgroup/systemd cgroup cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd
│ │ ├─/sys/fs/cgroup/cpu,cpuacct cgroup cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct
│ │ ├─/sys/fs/cgroup/perf_event cgroup cgroup rw,nosuid,nodev,noexec,relatime,perf_event
│ │ ├─/sys/fs/cgroup/rdma cgroup cgroup rw,nosuid,nodev,noexec,relatime,rdma
│ │ ├─/sys/fs/cgroup/devices cgroup cgroup rw,nosuid,nodev,noexec,relatime,devices
│ │ ├─/sys/fs/cgroup/net_cls,net_prio cgroup cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio
│ │ ├─/sys/fs/cgroup/blkio cgroup cgroup rw,nosuid,nodev,noexec,relatime,blkio
│ │ ├─/sys/fs/cgroup/pids cgroup cgroup rw,nosuid,nodev,noexec,relatime,pids
│ │ ├─/sys/fs/cgroup/memory cgroup cgroup rw,nosuid,nodev,noexec,relatime,memory
│ │ ├─/sys/fs/cgroup/cpuset cgroup cgroup rw,nosuid,nodev,noexec,relatime,cpuset
│ │ ├─/sys/fs/cgroup/hugetlb cgroup cgroup rw,nosuid,nodev,noexec,relatime,hugetlb
│ │ └─/sys/fs/cgroup/freezer cgroup cgroup rw,nosuid,nodev,noexec,relatime,freezer
│ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700
│ ├─/sys/kernel/debug debugfs debugfs rw,relatime
│ ├─/sys/kernel/config configfs configfs rw,relatime
│ └─/sys/fs/fuse/connections fusectl fusectl rw,relatime
├─/dev dev devtmpfs rw,nosuid,relatime,size=8054652k,nr_inodes=2013663,mode=755
│ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev
│ ├─/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
│ ├─/dev/mqueue mqueue mqueue rw,relatime
│ └─/dev/hugepages hugetlbfs hugetlbfs rw,relatime,pagesize=2M
├─/run run tmpfs rw,nosuid,nodev,relatime,mode=755
│ ├─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,size=1613400k,mode=700,uid=1000,gid=985
│ │ └─/run/user/1000/keybase/kbfs /dev/fuse fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=985
│ └─/run/docker/netns/07a9a88abf83 nsfs[net:[4026532513]]
│ nsfs rw
├─/tmp tmpfs tmpfs rw,nosuid,nodev
├─/boot /dev/nvme0n1p1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro
├─/home /dev/mapper/archvg-home
│ ext4 rw,relatime
├─/var/lib/docker/overlay2/a375c9d741cdc4a028b45432bbf717fcab31e455020fd9a35caa33d3d091b86d/merged
│ overlay overlay rw,relatime,lowerdir=/var/lib/docker/overlay2/l/YKROXQXIMTM5ZON4Q4IHFNJPCC:/var/lib/docker/overlay2/l/KHHAHRA7VX4L6KOXOW44IYDHPS:/var/li
├─/var/lib/docker/containers/6b2b84ce263a25e24dd50b239a14947e55e70843e9b31fe53ac830f73f8584f7/mounts/shm
│ shm tmpfs rw,nosuid,nodev,noexec,relatime,size=65536k
└─/keybase keybase-redirector
fuse ro,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other
Here is the steps I plan on taking
Boot from a live USB
# Step 1: Clone the current partition to a new partition
> dd if=/dev/mapper/archvg-root of=/dev/mapper/archvg2-root bs=4M
# Step 2: Extend the new partition
> cryptsetup open /dev/mapper/archvg2-root archlv
# Step 3: Enlarge the PV to use all the available remaining space of the partition
> pvresize /dev/mapper/archlv
## Review
> pvdisplay -m
# Step 4: Resize /home Logical Volume (trying to make it 100G)
> lvresize -L +90.2G /dev/CryptVolumeGroup/root
## Review
> pvdisplay -m
# Step 5: Resize encrypted volume (Trying to give it some space)
> resize2fs -p /dev/CryptVolumeGroup/root 101G
# Reboot
Here are other references of other's doing this differently which I'm still looking into if they have better methods or not.
- https://serverfault.com/questions/394902/resizing-a-luks-encrypted-volume (He's unmounting, not mentioned in Arch docs. Not sure I need to)
- Extend a LUKS encrypted partition to fill disk
- https://blog.tinned-software.net/increase-the-size-of-a-luks-encrypted-partition/ (seems like less steps)
findmnt
so we can get more information about your filesystems. – Emmanuel Rosa Mar 09 '19 at 12:59