Friday, April 19, 2013

Mounting an OpenBSD image on a Linux system

Use parted to find where the partition begins:
$ parted /var/lib/libvirt/images/OpenBSD52.img 
GNU Parted 2.1
Using /var/lib/libvirt/images/OpenBSD52.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) u                                                                
Unit?  [compact]? b                                                       
(parted) p                                                                
Model:  (file)
Disk /var/lib/libvirt/images/OpenBSD52.img: 4294967296B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End           Size          Type     File system  Flags
 4      32768B  10733990399B  10733957632B  primary  sun-ufs      boot
(parted) q
Mount it:
$ mkdir /tmp/openbsd
$ mount -r -o loop,offset=32768,ufstype=44bsd /var/lib/libvirt/images/OpenBSD52.img /tmp/openbsd
Now you can grab files from it, including things like the kernel and ramdisk:
cp /tmp/openbsd/bsd /tmp/openbsd/bsd.rd ~beaty

No comments: