Loopdevice

From Segfault
Jump to navigation Jump to search

FreeBSD

$ mdconfig -o readonly -f file.iso                               # Implies -a -t vnode
md0

$ mount -t cd9660 /dev/md0 /mnt/cdrom

$ umount /mnt/cdrom
$ mdconfig -d -u md0

Linux

$ losetup -f file.iso
$ losetup -a
/dev/loop0: [0306]:159092 (/root/file.iso)
$ mount -t iso9660 /dev/loop0 /mnt/cdrom

$ umount /mnt/cdrom
$ losetup -d /dev/loop0

MacOS X

$ hdiutil attach -readonly -nomount file.iso                     # Omit -nomount to actually mount it!
/dev/disk5
$ mount_cd9660 /dev/disk5 /mnt/cdrom

$ hdiutil detach /dev/disk5 
"disk5" unmounted.
"disk5" ejected.

NetBSD

$ vnconfig vnd0 file.iso
$ mount -t cd9660 /dev/vnd0a /mnt/cdrom/

$ umount /mnt/cdrom
$ vnconfig -u vnd0

OpenBSD

$ vnconfig vnd0 file.iso
$ mount -t cd9660 /dev/vnd0a /mnt/cdrom/

$ umount /mnt/cdrom
$ vnconfig -u vnd0

Solaris

$ lofiadm -a file.iso
/dev/lofi/1
$ mount -F hsfs -o ro /dev/lofi/1 /mnt/cdrom
 
$ umount /mnt/cdrom
$ lofiadm -d /dev/lofi/1