I use Arch Linux kernel 4.18.12-arch1-1-ARCH (november 2018).

I use a SATA caddy (for a Thinkpad T400) which holds a hard drive from an old laptop. I'd like to decide on combining the contents and extending the logical volumes rootvol and lvhome or keeping the current setup (see below). I only use the ext4 filesystem and both volumes contain data. Although this question seems to be answered here, I'm not sure what to do to prevent data loss.

So currently I boot from a luks encrypted SSD and I have a few symbolic links in $HOME pointing to directories on the lazy mounted hard drive to extend storage and which allows me to use my old $HOME on the hard drive.

sda                    8:0    0 223.6G  0 disk             
└─sda1                 8:1    0 223.6G  0 part             3d17c5b4-a603-4600-9f36-c598a7da783e
  └─root             254:0    0 223.6G  0 crypt            PRGLfW-Q18M-pPu8-nr6a-tloV-SS4W-kK1ROX
    ├─matrix-swapvol 254:1    0     2G  0 lvm   [SWAP]     38e862ef-e919-4388-810f-63ce187b342c
    └─matrix-rootvol 254:2    0 221.6G  0 lvm   /          c71a8292-c678-4a53-90da-3e4bf78cedbb
sdb                    8:16   0 232.9G  0 disk             
├─sdb1                 8:17   0   512M  0 part             14c635fb-6ee7-45c0-aefd-d3d7440116c0
└─sdb2                 8:18   0 232.4G  0 part             c36535d9-4098-4939-9ebe-6a2be950f3ea
  └─caddy            254:3    0 232.4G  0 crypt            kTkSk4-oemR-1fJi-4brz-OXmW-DEZk-rqF2pN
    ├─vgarch-lvswap  254:4    0     4G  0 lvm              a1932471-209e-4d47-85dc-c4ea1ce37de8
    ├─vgarch-lvroot  254:5    0    15G  0 lvm              67d37f85-c2c0-40e7-88e9-afd4a6c1c561
    └─vgarch-lvhome  254:6    0 211.2G  0 lvm              dd89d271-776a-426a-826d-9f4d7056fc6a

As can be seen, for whatever reason I decided on using lvm on luks twice. Note that the SSD has no /boot partition: it is decrypted with the help of a libreboot ROM image. During boot, an entry in crypttab for /dev/sdb2's UUID unlocks the harddrive using a key file in /. Then, I use systemd's automount service to mount or unmount it whenever needed:

# /etc/fstab
# /dev/mapper/vgarch-lvhome
UUID=dd89d271-776a-426a-826d-9f4d7056fc6a /mnt/caddy ext4 rw,noatime,data=ordered,noauto,nofail,x-systemd.automount,x-systemd.device-timeout=20,x-systemd.idle-timeout=2min 0 0

I recursively changed the ownership of files in lvhome. As I have no need for lvroot and lvswap I'll be removing them along with /dev/sdb1 which contains /boot.

So how can these be combined? Is that advisable? (because of different uses for SSD and HDD) It is suggested to copy the contents over to the other filesystem first, but doesn't this defeat the purpose of lvm? I thought it would've been easy to grow or shrink the filesystem, but I guess I imagined features from the zfs world.


LVM provides logical volumes, which are logical block devices, and makes it easy to grow, shrink, relocate, snapshot, etc. those block devices. You can then use these block devices any way you like... it could be a filesystem, or something else like a virtual HDD for a VM with its own partition table and everything.

LVM does nothing on the filesystem level. So it's up to the filesystem to support handling those grown or shrunk block devices, or to the VM to resize their partition table.

Most filesystems support growing (but sometimes not online, or not past a certain limit), but a few of them don't support shrinking. So although LVM has no qualms about shrinking the block device, you'd have to shrink the filesystem first and for some filesystems, that just isn't possible.

Merging contents of two separate filesystems is usually not supported.

So yes, in some cases, you have to copy files the old-fashioned way. And then abandon/remove the LV those files were on, and use the freed space to expand the LV and grow the filesystem you copied the files to.

So how can these be combined? Is that advisable? (because of different uses for SSD and HDD)

I would not create a block device that is backed half by SSD and half by HDD. I like to keep these separate.

It might make sense in some other situations, e.g. you can do a SSD-HDD-RAID1 where the HDD is set to write-mostly, which means all reads will normally be served by SSD as it's faster. However with dropping SSD prices, that setup is less common as you can just use two SSD for regular RAID1 instead.

  • Thanks. One motivation for merging the two is in fact to reduce writing to the SSD. This tool mentions bcache, which is probably useful in such a scenario. Do you have experience with bcache? I'll probably keep it as-is, though. Keeping the hard disk mounted is not very battery friendly. – Bart Nov 2 '18 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.