Atari Partition Scanning Bug ============================ Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> The installation program for Debian 2.1 (as in boot disks version 2.1.8 from Mar 1st 1999) has a bug in scanning Atari partitions. Since it's unlikely new Debian 2.1 boot disks will be uploaded before Debian 2.2 is ready, I'll describe the bug and possible workarounds here. Description ----------- The installation program (called "dinstall") checks all disks for existing partitions. It also supports multiple partitions formats (Atari, Amiga, PC, Solaris, ...) Unfortunately, I've made an unlucky bug in the Atari partition parser. The parser first checks for each disk if it is partitioned in Atari format at all. It assumes this if at least one of the 4 partition entries in the root sector seems valid, more exactly if it satisfied all these conditions: - It has the 'valid' flag set. - The partition id are 3 alphanumeric characters. - The start end the end of the partition are within the boundaries of the disk. If no entry satisfies all these conditions, the disk is rejected and dinstall will see no (Atari) partitions on it. And last of the conditions is the problem: The variable giving the size of the whole disk is measured in kBytes (1024 bytes), whereas the partition start and end are calculated in sectors (512 bytes). The two aren't really comparable, so that simple test often fails where it shouldn't. Workaround ---------- If you know what's done wrong, it's easy to see how to work around it. From the description follows, that the disk is considered valid only if at least one partition is completely within the first half of the disk (size in kByte = size in sectors / 2). To repeat it cleary: At least one partition in the root sector must be fully contained inside the first half of the disk, if the partitions on it should be recognized by dinstall. Some more details to what is meant by "partition entry in the root sector": The original Atari format only allowed 4 partitions, for each of which an entry in the root sector was provided (I'll call those "primary partitions"). Later an extension scheme was invented to allow more than 4 partitions by a so-called "extended partition". This is a kind of virtual partition that has an entry in the root sector. However, it contains no data but other partitions. The workaround works only, if a *primary* partition or (if it exists) the *whole extended* partition is fully in the first half. Unfortunately, you can't see easily which partitions are primary and which not. But usually the first three should be primary. If the disk has more than 4 partitions, there must be an extended partition, and it usually occupies that last entry in the root sector, so the first three are primary. If there are less than 4 partitions, all of them should be primary. If there are exactly 4, most time all 4 should be primary, but it's possible that the 4th is inside an extended partition to make addition of other partitions easier. A method to find it out exactly is atari-fdisk: Just start it on the disk in question and give the 'p' (print) command. In the output, there's a column labelled "rootsector". If the value is 0, the partition is suitable for the workaround. Solutions --------- Here are some receipts how you can work around the dinstall bug: - First of all: If dinstall ignores partitions on disk you don't need while installing Linux, don't bother to fix it. Then it's only a cosmetical problem :-) - If you repartition a whole disk anyway, try to create some small partition (e.g. the swap partition) at the start. Then the condition (one primary partition inside first half) should be satisfied relatively easy. If you don't want/need a swap partition on this disk, maybe you want to have some smaller partition (less than half the size of the disk) anyway, but in a different position. Then simply try to create this partition as the first one. Physical positions of a partition usually do not matter much under Linux. - If you really want to have only one or two big partitions on the disk, the following might be an idea: Create a dummy partition that contains only 1 sector. It can be physically at the end, as long it is still a primary partition. And one sector less isn't that much :-) - If nothing else works, this can help, but is a bit dangerous: Create a partition (it must be a primary one) and contains only sector 1, even if sector 1 already belongs to another partition. To avoid loss of data, make the partition ID something like "XXX" so that no operating system will think it owns that partition. Never mount or otherwise touch the dummy partition later under Linux. If you have created a dummy partition as workaround, you can delete it after the Debian installation. This will have no side effects at all if it was the last partition (last case above). Otherwise, however, deleting the dummy partition will change the partition numbers of all following partitions. You may have to change your /etc/fstab accordingly. Roman