wblock said:The technique depends on the type of image file.
# file bin.img
bin.img: x86 boot sector; partition 1: ID=0x83, active, starthead 0, startsector 1, 593919 sectors
# mdconfig -a -t vnode -f bin.img -u 0
# mdconfig -l
md0
# mount -t ext3 /dev/md0 /mnt/cc
mount: /dev/md0 : Operation not supported by device
# mount -t ext2 /dev/md0 /mnt/cc
mount: /dev/md0 : Operation not supported by device
# /usr/src/sbin/mount_ext2fs /dev/md0 /mnt/cc
/usr/src/sbin/mount_ext2fs: Permission denied.
# /usr/src/sbin/mount_ext2fs bin.img /mnt/cc
/usr/src/sbin/mount_ext2fs: Permission denied.
ccc said:I've done, but cannot mount it:Code:# mdconfig -a -t vnode -f bin.img -u 0 # mdconfig -l md0 # mount -t ext3 /dev/md0 /mnt/cc mount: /dev/md0 : Operation not supported by device # mount -t ext2 /dev/md0 /mnt/cc mount: /dev/md0 : Operation not supported by device
Code:# /usr/src/sbin/mount_ext2fs /dev/md0 /mnt/cc
# mount -t ext2fs /dev/md0s1 /mnt/cc
mount: /dev/md0s1 : Invalid argument
# mount_ext2fs
mount_ext2fs: Command not found.
# uname -a
FreeBSD bsd.net 7.3-RELEASE-p2 FreeBSD 7.3-RELEASE-p2 #0: Mon Jul 12 19:04:04 UTC 2010
root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
wblock said:"Invalid argument" usually means it's not what you think it is.
Do not use mount_ext2fs, it's gone.
Ask file(1) about that first slice:
# file -s /dev/md0s1
# file -s /dev/md0s1
/dev/md0s1: x86 boot sector
# mount -o loop,offset=512 bin.img /mnt/cc
ccc said:Code:# file -s /dev/md0s1 /dev/md0s1: x86 boot sector
BTW on linux I can mount this image file using:Code:# mount -o loop,offset=512 bin.img /mnt/cc
[root@fb91 ~]# mdconfig -f ~john/src/z/osj/sdx
md0
[root@fb91 ~]# mount -t ext2 /dev/md0 ~john/src/z/osj/fs
mount: /dev/md0: Operation not supported by device
[root@fb91 ~]# ls /dev/md*
/dev/md0 /dev/mdctl
[root@fb91 ~]# file -s /dev/md0
/dev/md0: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=ceed52c9-7aed-4a5f-ba81-e90abf8447b9
# gnop create -o 512 /dev/md0
[root@fb91 ~]# ls -l /dev/md0
crw-r----- 1 root operator 0, 125 Apr 10 14:06 /dev/md0
[root@fb91 ~]# mount -v -v -v -t ext2 /dev/md0 /var/local/fs
mount: /dev/md0: Operation not supported by device
/dev/gpt/91root on / (ufs, NFS exported, local, noatime, journaled soft-updates, writes: sync 0 async 47, reads: sync 919 async 5, fsid c6f22351fba90533)
Nice! :beergrin For some time now I was wondering how to do it under FreeBSD other than using dd andkpa said:How about using gnop(8) and its -o option to create a virtual disk that omits the first 512 bytes of the original image:
gnop
somehow didn't come into my mind. As I was always in hurry I used Linux (offset) to do it.You are right. I didn't go through the whole page when I was looking for a solution, I was only searching for "offset", which is not there. And you know how it is sometimes when you have to solve something fast - you either look and read or use something you know already.wblock@ said:There is an example at the end of mdconfig(8).