How to set the UUID on a swap partition?

Charles Curley charlescurley at
Mon Nov 5 20:02:52 MST 2007

How does one set the UUID of a swap partition to a given value?

The problem is in recreating a hard drive for bare meta
restoration. Ubuntu Gutsy Gibbon assigns partitions via UUIDs rather
than device names. I can examine fstab or the dark basement of /dev to
get the UUIDs. However, at restoration time, I must then assign them
to newly minted devices.

The e2fs tools provide a tool for doing this, tune2fs. However, it
does not appear to be a way to do this directly for swap partitions.

I have a kludge: put an e2fs file system on the partition, assign the
UUID, then run mkswap on it. It's ugly, but it gets you there. Is
there a better way to do this?


Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email    / \    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: Digital signature
Url : 

More information about the PLUG mailing list