Mapping Swap Partition Devices to Labels

Charles Curley charlescurley at charlescurley.com
Thu Apr 21 16:18:06 UTC 2005


I maintain the Linux Documentation Project HOWTO on bare metal
restoration,
http://www.charlescurley.com/Linux-Complete-Backup-and-Recovery-HOWTO.html.
As part of that, I maintain some scripts that detect hard drive setup
and in turn build other scripts to reconstruct hard drive setup.

I see that a fresh installation of FC3 will use a label to mount a
swap partition. I can examine an ext[2|3]fs partition with dumpe2fs to
determine its label, if any, or given a mounted partition, go from a
device to its label. However, swap partitions do not show up in mount
(for very good reason).

If I know I only have one swap partition, then scanning fstab gives me
the label. However, if I have multiple swap partitions, scanning fstab
is not enough. The labels for FC3 seem to be of the form "SWAP-hda5"
for /dev/hda5, but if I assume that form in my scripts, I am dependent
on that form continuing into the future. I am also dependent on system
builders other than Anaconda using that form, a dubious proposition.

Is there any tool that lets me read the label from any partition at
all, or from swap partitions in specific?

Thank you.

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050421/a7004be2/attachment-0001.sig>


More information about the fedora-list mailing list