Bug 121699

Summary: fdisk does not know about the Amiga partition table
Product: [openSUSE] SUSE Linux 10.1 Reporter: peter czanik <peter>
Component: BasesystemAssignee: Ruediger Oertel <ro>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: werner
Version: Alpha 1   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description peter czanik 2005-10-07 19:09:53 UTC
Pegasos uses the Amiga partition table on HDDs. fdisk does not know anythinga
about it:

czp:~ # fdisk -l
Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/hda doesn't contain a valid partition table

fdisk is also used in some boot scripts, so this last line is visible during
system start-up.

parted has no problem with it at all, so fdisk should probably be replaced by
parted:

czp:~ # parted /dev/hda print
Disk geometry for /dev/hda: 0kB - 40GB
Disk label type: amiga
Number  Start   End     Size    File system  Name                  Flags
1       8225kB  1078MB  1069MB  ext2         boot
2       1078MB  2147MB  1069MB  linux-swap   swap
3       2147MB  12GB    9656MB  reiserfs     debian
4       12GB    21GB    9656MB  ext3         ubuntu
5       21GB    31GB    9656MB  ext3         gentoo
Information: Don't forget to update /etc/fstab, if necessary.

(ps: I did not change the 'Name' field, but two partitions are already running SuSE)
Comment 1 Mads Martin Joergensen 2005-10-10 09:29:49 UTC
Which bootscripts?
Comment 2 peter czanik 2005-10-10 10:20:32 UTC
The script is /etc/rc.d/boot.swap
So, during boot, there is a message:
"Disk /dev/hda doesn't contain a valid partition table"
Comment 3 Mads Martin Joergensen 2005-10-10 11:04:16 UTC
Rudi, would it be an option to use parted in /etc/init.d/boot.swap?
Comment 4 Ruediger Oertel 2005-10-18 12:09:19 UTC
since parted is in Minimal: yes.

anyone has a patch ?
the problem is not really parsing the output, but getting the correct
device name. "fdisk -l" simply outputs all devices ...
Comment 5 Dr. Werner Fink 2005-10-18 13:31:06 UTC
`parted' has NO listing mode for all devices.
Therefore you can not search with `parted'.
Comment 6 Dr. Werner Fink 2005-10-18 14:11:32 UTC
OK we may use just this

get_swap_id()
{
    local maj min blks dev type
    while read maj min blks dev ; do
        test "$dev" != name     || continue
        test -n "$dev"          || continue
        test -d /sys/block/$dev || continue
        while read min type; do
            case "$type" in
            *type=82|*type=82,*) echo /dev/${dev}${min}
            esac
        done < <(parted -s /dev/$dev print quit)
    done < /proc/partitions
}

BUT it is MUCH slower than this old solution!
Comment 7 Dr. Werner Fink 2005-11-15 15:34:55 UTC
Now we run parted in the case that fdisk fails.
Comment 8 peter czanik 2005-11-20 19:24:05 UTC
Where? I still get the fdisk error messages on bootup, and couldn't find parted related lines in /etc/init.d/boot.swap