Last active
June 12, 2025 20:32
-
-
Save fabiojmendes/296a68f12854b96bb72ec4032cf2b354 to your computer and use it in GitHub Desktop.
Mount LXD zvol block devices on linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
References:
https://blog.dbalan.in/blog/2024/01/12/mount-a-zvol-under-linux/index.html