Mounting FreeBSD partitions inside a LVM volume in linux
No need for kpartx in this case. Just check the FreeBSD disklabels inside the logical volume. This can be done using fdisk:
#fdisk /dev/vg0/backup
Command (m for help): b
Reading disklabel of /dev/vg0/backup1 at sector 64.
BSD disklabel command (m for help): u
Changing display/entry units to sectorsBSD disklabel command (m for help): p
8 partitions:
# start end size fstype [fsize bsize cpg]
a: 4194367 25165886 20971520 4.2BSD 2048 16384 28552
b: 63 4194366 4194304 swap
c: 63 146785904 146785842 unused 0 0
d: 25165887 46137406 20971520 4.2BSD 2048 16384 28552
e: 46137407 146785904 100648498 4.2BSD 2048 16384 28552
Easier and faster with sfdisk:
#sfdisk -d /dev/vg0/backup# partition table of /dev/vg0/
backupunit: sectors
/dev/vg0/backup1 : start= 63, size=146785842, Id=a5, bootable
/dev/vg0/backup2 : start= 0, size= 0, Id= 0
/dev/vg0/backup3 : start= 0, size= 0, Id= 0
/dev/vg0/backup4 : start= 0, size= 0, Id= 0
/dev/vg0/backup5 : start= 4194367, size= 20971520
/dev/vg0/backup6 : start= 63, size= 4194304
/dev/vg0/backup7 : start= 25165887, size= 20971520
/dev/vg0/backup8 : start= 46137407, size=100648498
Now multiply the start sectors by 512 and use the result as an offset in the mount options:
#mount -t ufs -o ufstype=ufs2,offset=23622352384,ro /dev/vg0/backup /mnt/backup/
Notice the ro (read-only) flag, as most linux distributions don’t come with UFS write support.