Bug 291391 - confusing label for swapspace
confusing label for swapspace
Product: Fedora
Classification: Fedora
Component: anaconda (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: Anaconda Maintenance Team
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-09-14 14:13 EDT by John Reiser
Modified: 2008-04-22 11:15 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-04-22 11:15:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Reiser 2007-09-14 14:13:04 EDT
Description of problem: A label such as "SWAP-sdc5" is applied to a
newly-formatted swap partition.  The last portion "sdc5" is based on anaconda's
enumeration of drives, which is often NOT the same as the enumeration used by
the installed system.  For instance, in the running system the partiion can be
sda5.  This causes needless confusion.

Version-Release number of selected component (if applicable):

How reproducible: always

Steps to Reproduce:
1. Custom manual disk layout install on 3-drive system: 1 PATA, 2 SATA drives. 
The PATA drive and the last SATA drive are pre-partitioned, with partion 5 on
each drive having type 82 (Linux swap) but with no "SWAPSPACE2" magic number.
2. Select partition 5 on the PATA drive (pre-partitioned as type 82, but with no
"SWAPSPACE2" marking), and ask manual disk druid to format it as swap.  Anaconda
calls this /dev/sdc5.
Actual results:  Label "SWAP-sdc5" is written to partition 5 of the PATA drive,
and "LABEL=SWAP-sdc5" is inserted in /etc/fstab designating swap space. 
"/dev/sda5", which is anaconda's name for the [unformatted] partition 5 on the
last SATA drive, is also written to /etc/fstab as swap space.  When booted into
the installed system, the drives are enumerated backwards compared to anaconda.
 So the unformatted partition 5 on the last SATA drive is now /dev/sdc5, while
the label "SWAP-sdc5" appears on the partition which is now called /dev/sda5. 
The system uses only /dev/sda5, the 5th partition on the PATA drive, as swap space.

Expected results: Label for swapspace should not depend on enumeration order.
Instead, use the SerialNo from "hdparm -i /dev/sdX".

Additional info:
Comment 1 Jeremy Katz 2007-09-17 21:42:35 EDT
The serial number is going to be way too long.  The label for swaps is limited
to 15 characters.
Comment 2 John Reiser 2007-09-17 23:13:12 EDT
Take the rightmost 9 characters (non-blank) of the serial number.  Pre-pend with
"SWAP-X" where X is the partition number [1-9a-f] of the drive.  Then check for
uniqueness among the other such numbers on drives that are currently visible. 
Adjust the 'X'  as necessary [move to a different set of 15 characters.] to make
it unique among the labels that are currently visible.

Serial numbers that I observe range from 10 characters for Seagate and Maxtor
drives to 16 characters for Hitachi drives.
Comment 3 Chris Lumens 2008-04-22 11:15:45 EDT
We should be using UUIDs for swap space on regular partitions now, so while they
are no longer very readable they should not be confusing.

Note You need to log in before you can comment on or make changes to this bug.