How to set label on swap partition (SOLVED)

Paul Howarth paul at city-fan.org
Sat Mar 12 10:31:11 UTC 2005


On Fri, 2005-03-11 at 19:04 -0500, Jeff Kinz wrote:
> On Fri, Mar 11, 2005 at 09:05:43PM +0000, Paul Howarth wrote:
> > On Fri, 2005-03-11 at 15:07 -0500, Jeff Kinz wrote:
> > > On Fri, Mar 11, 2005 at 10:02:05PM +0200, Pasha R wrote:
> > > > It appears that mkswap does have a -L option, though undocumented in man
> > > > page. Using it fixed my problem.
> > > > 
> > > > BTW, how do you set label in fdisk? I tried that, but could not find an
> > > > appropriate option.
> > > 
> > > from the "m" command ("m" for "help" :-) )
> > >    "t"   change a partition's system id
> > > 
> > > The type for linux swap is "82"
> > 
> > That's setting the partition type in the partition table, which is not
> > the same as the filesystem label, which lives "inside" the filesystem on
> > each partition.
> 
> <Hesitantly>
> ummm - but a swap partition has no "filesystem" per se.  Just a chunk of
> addressable bytes, nicht?
> 
> I have to assume that Pasha is talking about the partition type ID
> since you (might, probably?) have to know what the type of filesystem,
> if any, a partition contains, before you can "read it" to retrieve any
> label?
> 
> </Hesitantly>

If you look at the bugzilla entry I referenced earlier in the thread,
there's a description there of the "swap header":

> Here's what the swap header looks like:
> 
> At offset 0, the structure:
> struct swap_header_v1_1 {
>         char         uuid[16];
>         char         volume_name[16];
> 	char         bootbits[1024-32];    /* Space for disklabel */
> 	unsigned int version;
> 	unsigned int last_page;
> 	unsigned int nr_badpages;
> 	unsigned int padding[125];
> 	unsigned int badpages[1];
> };
> 
> At offset getpagesize()-10, the characters "SWAPSPACE2".
> 
> mkswap will have a -L label, and swapon will start accepting UUID= and
> LABEL=, and that should about be it.

So the "bootbits" field of the header is being used as the label.
Perhaps not a regular filesystem, but able to be labelled anyway.

Paul.
-- 
Paul Howarth <paul at city-fan.org>




More information about the fedora-list mailing list