I checked the man page for mkswap and was left confused whether mkswap tests whether a partition is of type 82 before formatting it.
Background: I am using Ubuntu 11.04, and I had just set up my swap partition to be encrypted, using ecryptfs-setup-swap, which adds a reference to the encrypted swap partition to /etc/fstab and to the actual partition to /etc/crypttab. The actual partition is referred to by the device name, /dev/sdb1 in my case. If I understand correctly, during boot, the virtual partition is created and formatted as a swap partition, generating a new UUID each time, so it cannot be specified by UUID. This leaves me concerned that if I install a new hard drive or otherwise rearrange the physical drives, mkswap would try to format the wrong partition. If it fails because the partition isn't a swap partition, then no problem, as swap is rarely used. If it succeeds in formatting the wrong partition, then big problem.