Skip to content

Instantly share code, notes, and snippets.

@fabiojmendes
Last active June 12, 2025 20:32
Show Gist options
  • Save fabiojmendes/296a68f12854b96bb72ec4032cf2b354 to your computer and use it in GitHub Desktop.
Save fabiojmendes/296a68f12854b96bb72ec4032cf2b354 to your computer and use it in GitHub Desktop.
Mount LXD zvol block devices on linux
# Make sure the zvol type is set to dev
zfs list -t volume -o name,volmode
zfs set volmode=dev tank/lxd/virtual-machines/disk.block
# Optionally you can inspect the block device using fdisk or similar
fdisk /dev/zvol/tank/lxd/virtual-machines/disk.block
# Add the partition mappings to /dev/mapper
kpartx -a /dev/zvol/tank/lxd/virtual-machines/disk.block
# Mount the disk
mount /dev/mapper/disk.block1 /mnt/
# Cleanup
umount /mnt
kpartx -d /dev/zvol/tank/lxd/virtual-machines/disk.block
@fabiojmendes
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment