[HOWTO] Linux: Mount & create pcem images
Posted: Thu 13 Apr, 2017 5:44 pm
Since it's not possible to use shared folders with pcem, mounting an image to copy software is necessary.
With Linux it's straight forward, if you pay attention to a few things - I struggled especially with a bootable image (offset parameter), so I hope it helps:
I. If you have created an image with pcem, you'll find an image file.
1. In terminal type:
It tells you "sector size" and "start". "Start" is where the filesystem starts which depends on your image, e.g. if it's the boot image and OS.
If your image contains multiple partitions, they are all shown with their starting sectors. Note, that extended partitions are just structures for logical partitions, that can't be mounted; only mount partitions, for which fdisk identifies a filesystem.
For the first partition, the offset would be 512 * 17 = 8407, for the second - logical drive - 512*41072 = 21028864.
Note: For me it didn't make a difference, if fdisk -l is invoked without special drive specs (see II.2.). Try it, maybe it makes a difference in some cases like using real disc images.
2. To mount it just type:
The offset is essential to mount the image correctly !
3. If it requires root rights to do, just mount as root or check your distributions help, how to mount with user privileges (e.g. add to fstab).
If mounted as root, adding
will allow everbody to read and write the image.
Running pcem with a mounted disc doesn't seem to work, so unmount the disc when starting pcem / exit pcem before mounting.
II. You can create an image with linux too.
1. Create an image file
2. Get ancient drive specs
Run pcem and check in BIOS, which drives are supported by your "computer". Most BIOS have a lot of predefined disc specs they accept.
E.g. Classical hard disc (nr. 14 in Amibios):
3. Create partition with fdisk
For MSDOS:
a. Press "c" for DOS compatibility
b. Press "n" to create a partition
c. Press "t" to change partition type to 6 (FAT16)
d. Press "w" to write changes
You'll have to format filesystem with MSDOS Format, mkdosfs doesn't seem to work for image
4. Add the disc to pcem in settings & BIOS
With Linux it's straight forward, if you pay attention to a few things - I struggled especially with a bootable image (offset parameter), so I hope it helps:
I. If you have created an image with pcem, you'll find an image file.
1. In terminal type:
Code: Select all
fdisk -l <your.img>
If your image contains multiple partitions, they are all shown with their starting sectors. Note, that extended partitions are just structures for logical partitions, that can't be mounted; only mount partitions, for which fdisk identifies a filesystem.
Code: Select all
fdisk -l hdd2.img
Disk hdd2.img: 42 MiB, 44040192 bytes, 86016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
hdd2.img1 17 41054 41038 20M 4 FAT16 <32M
hdd2.img2 41055 87107 46053 22.5M 5 Extended
hdd2.img5 41072 87107 46036 22.5M 4 FAT16 <32M
Note: For me it didn't make a difference, if fdisk -l is invoked without special drive specs (see II.2.). Try it, maybe it makes a difference in some cases like using real disc images.
2. To mount it just type:
Code: Select all
mount -o loop,offset=<start*sectorsize> <your.img> <desired mount point>
3. If it requires root rights to do, just mount as root or check your distributions help, how to mount with user privileges (e.g. add to fstab).
If mounted as root, adding
Code: Select all
-o umask=000, ...
will allow everbody to read and write the image.
Running pcem with a mounted disc doesn't seem to work, so unmount the disc when starting pcem / exit pcem before mounting.
II. You can create an image with linux too.
1. Create an image file
Code: Select all
dd if=/dev/zero of=<your.img> bs=1M count=<desired MB>
Run pcem and check in BIOS, which drives are supported by your "computer". Most BIOS have a lot of predefined disc specs they accept.
E.g. Classical hard disc (nr. 14 in Amibios):
Code: Select all
42 MB, 733 cyclinders, 7 heads, 17 sectors, 512 bytes/sector
Code: Select all
fdisk -C <cylinders> -H <heads> -S <sectors> <your.img>
a. Press "c" for DOS compatibility
b. Press "n" to create a partition
c. Press "t" to change partition type to 6 (FAT16)
d. Press "w" to write changes
You'll have to format filesystem with MSDOS Format, mkdosfs doesn't seem to work for image
4. Add the disc to pcem in settings & BIOS