As part of my reinstallation, I had to create a ZFS partition that I used to use for personal storage. Debian Installation process doesnt provide this option, so I have to do it manually. To be honest, it is good to remember/refresh these “basic” things, you never know when you are going to need them (urgently very likely).
As the installation process gave most of the space to the “home” partition, that’s the one I need to take space for creating my ZFS partition. I chose LVM during installation so I dont really have to deal with physical partition, it is mainly logical volumes aka “lv”.
So I rebooted in single-mode as I wanted to be sure that I didnt damage anything and I had to umount the “home” lv. So as root:
Check mounted partitions # df -hT Checks LV summary # lvs Umount /home # umount /home/ Check "home" is not munted # df -hT Check VolgumeGroup summary # vgs Perform filesystem check before making any change # e2fsck -fy /dev/mapper/athens--vg-home Resize filesystem to 22G # resize2fs /dev/mapper/athens--vg-home 22G Check LV hasnt changed # lvs Reduce LV for home to 22G # lvreduce -L 22G /dev/mapper/athens--vg-home Check LV home is reduced # lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert home athens-vg -wi-ao---- 22.00g root athens-vg -wi-ao---- <27.94g swap_1 athens-vg -wi-ao---- 976.00m # Check you have free space in the VG # vgs VG #PV #LV #SN Attr VSize VFree athens-vg 1 3 0 wz--n- 237.48g <186.59g # Reboot to be sure everything is fine # reboot Check all partitions are mounted and "home" is just 22G $ df -hT Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 786M 1.6M 785M 1% /run /dev/mapper/athens--vg-root ext4 28G 6.7G 20G 26% / tmpfs tmpfs 3.9G 87M 3.8G 3% /dev/shm tmpfs tmpfs 5.0M 8.0K 5.0M 1% /run/lock /dev/sda2 ext2 456M 72M 360M 17% /boot /dev/mapper/athens--vg-home ext4 21G 3.0G 17G 16% /home /dev/sda1 vfat 496M 64M 433M 13% /boot/efi tmpfs tmpfs 786M 40K 786M 1% /run/user/1000 $ Create new LV "storage" using the spare space in the VG # lvcreate -L 186G -n storage athens-vg Logical volume "storage" created. # Check VG space has reduced # vgs VG #PV #LV #SN Attr VSize VFree athens-vg 1 4 0 wz--n- 237.48g 604.00m # Check we have a new LV storage of 186G # lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert home athens-vg -wi-ao---- 22.00g root athens-vg -wi-ao---- <27.94g storage athens-vg -wi-a----- 186.00g swap_1 athens-vg -wi-ao---- 976.00m # Create our Zpool storage using the LV storage. # zpool create storage /dev/mapper/athens--vg-storage Check Zpool status # zpool status pool: storage state: ONLINE config: NAME STATE READ WRITE CKSUM storage ONLINE 0 0 0 athens--vg-storage ONLINE 0 0 0 errors: No known data errors # Check mount point for ZFS pool # zfs get mountpoint storage NAME PROPERTY VALUE SOURCE storage mountpoint /storage default # Change Zpool storage mount point to a point in my home dir # zfs set mountpoint=/home/tomas/storage storage Check ZFS list # zfs list NAME USED AVAIL REFER MOUNTPOINT storage 165K 179G 24K /home/yo/storage # Check all partitions $ df -hT Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 786M 1.6M 785M 1% /run /dev/mapper/athens--vg-root ext4 28G 6.7G 20G 26% / tmpfs tmpfs 3.9G 87M 3.8G 3% /dev/shm tmpfs tmpfs 5.0M 8.0K 5.0M 1% /run/lock /dev/sda2 ext2 456M 72M 360M 17% /boot /dev/mapper/athens--vg-home ext4 21G 3.0G 17G 16% /home /dev/sda1 vfat 496M 64M 433M 13% /boot/efi tmpfs tmpfs 786M 40K 786M 1% /run/user/1000 storage zfs 180G 128K 180G 1% /home/y/storage $
I have used these links to refresh myself:
- lvs resize: https://www.rootusers.com/lvm-resize-how-to-decrease-an-lvm-partition/
- create lv: https://www.thegeekstuff.com/2010/08/how-to-create-lvm/
- create zfs pool: https://ubuntu.com/tutorials/setup-zfs-storage-pool#3-creating-a-zfs-pool
- change zfs mount point: https://docs.oracle.com/cd/E19253-01/819-5461/gaztn/index.html
To be honest, I thought I was going to struggle much more but it has been quick.
Step by step getting back to my normal environment (and trying to improve it). I said it before, I should be able to reinstall my laptop easily, like a production server….