需求
备份全盘img镜像需要挂载读取部分内容
镜像含有多个分区无法直接mount
解决
# map image to multiple disk partition
kpartx -av disk.img
# mount the partition you want
sudo mount -o loop /dev/mapper/loop1p1 /mnt/rootfs
# Delete partition mappings after use
kpartx -d disk.img
参考
Ubuntu Manpage: kpartx - Create device maps from partition tables.