Skip to content

afs hd_partition_linux

Thorsten Otto edited this page Feb 6, 2018 · 1 revision

Partition the hard disk image under Linux

Linux come with several partition utilities: mpartition (from mtools), cfdisk, fdisk, sfdisk, parted and many more. All these tools will create a PC-like root sector on the hard disk image, so not all Atari hard disk drivers can be installed on these.

ID you can use for partitions are 04 (FAT16<32MB), 06 (FAT16), 83 (Linux) for the most useful for an Atari system.

EmuTOS supports the PC root sector format without an hard disk driver.

BEWARE! Partitionning a disk image from host side, is made in the endianness of the host for the partition type supported, i.e. little endian format for a PC root sector format. Using it in EmuTOS is not a problem, but if you switch to TOS, with a hard disk driver, then this one must be setup to swap bytes if it does not support this type of root sector, or something will go wrong when you try to use the hard disk image under TOS.

Using fdisk

You need to give it the C/H/S parameters of the disk image, as written in ARAnyM config file. In our case:

  $ /sbin/fdisk -C 8 -H 16 -S 63 /path/to/harddisk.img

Press 'm' for some help. You need to create a partition (and choose its ID), then write the created partition table to the image before quitting.

Using sfdisk

You need to give it the C/H/S parameters of the disk image, as written in ARAnyM config file. In our case:

  $ /sbin/sfdisk -C 8 -H 16 -S 63 /path/to/harddisk.img
  Warning: test.img is not a block device
  Disk test.img: cannot get geometry

  Disk test.img: 8 cylinders, 16 heads, 63 sectors/track

  sfdisk: ERROR: sector 0 does not have an msdos signature
   test.img: unrecognized partition table type
  Old situation:
  No partitions found
  Input in the following format; absent fields get a default value.
  <start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
  Usually you only need to specify <start> and <size> (and perhaps <type>).

  test.img1 :

Now the program asks for each partition its infos. The partitions are named 'test.img[n]'. To create a single partition covering all the image, which ID is 4 (FAT16<32MB), just enter:

  ,,4

The program will use default for start and size, which is all the disk, and set the partition ID to 4. Then it will ask the same for the other primary partitions, just reply with enter.

  test.img1          0+      7       8-      4031+   4  FAT16 <32M
  test.img2 :
  test.img2          0       -       0          0    0  Empty
  test.img3 :
  test.img3          0       -       0          0    0  Empty
  test.img4 :
  test.img4          0       -       0          0    0  Empty
  New situation:
  Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

     Device Boot Start     End   #cyls    #blocks   Id  System
  test.img1          0+      7       8-      4031+   4  FAT16 <32M
  test.img2          0       -       0          0    0  Empty
  test.img3          0       -       0          0    0  Empty
  test.img4          0       -       0          0    0  Empty
  Warning: no primary partition is marked bootable (active)
  This does not matter for LILO, but the DOS MBR will not boot this disk.
  Do you want to write this to disk? [ynq]

Just reply 'y' to write your changes.

  Successfully wrote the new partition table

  Re-reading the partition table ...
  BLKRRPART: Ioctl() inappropré pour un périphérique
Clone this wiki locally