Preparing disk images

Let’s say you want to create a disk image for burning to a CD. You need to create a filesystem within a BFS (BeOS File System) file, mount it as a new volume, and copy all your stuff into it. Here’s how:
Create a file with dd. In a Terminal type:

dd if=/dev/zero of=image.img bs=1024k count=640

Replace 640 with the size in megabytes you want the image to have. Then type:

mkbfs 2048 image.img; sync

This will create a filesystem in the file. It’s important to use a block size of 2048 bytes here, because BeOS can’t handle logical blocksizes that are smaller than the physical sectorsize of the device. Since CDs use 2048-byte sectors, you need to create 2048-byte blocks. „sync“ needs to be called because otherwise you might get an error message when trying to mount it. Lastly, mount the image:

mkdir /mnt; mount -t bfs image.img /mnt

The (empty) „disk“ will now appear on your desktop, and you can start copying stuff into it normally. When you’re done, unmount it and and burn image.img to a CD.
Warning: If you’re using BeOS R3, attempting to mount a file will lock up your system.
Peter Schultz (pete at beforever dot com) adds that you can also give the image a volume name while you’re creating it, or create the volume without an index. The complete mkbfs usage options are:

mkbfs [-noindex] [block_size] device_name [volumename]


No comments so far.

(comments are closed)