I have installed two Ubuntu partitions and they appear to be using two different swap partitions. Is this a safety thing or is it a waste of space? If the latter, how do I set up one Ubuntu to use the other's swap partition?

  • What do you mean with 'Ubuntu-partitions'? A partition normally holds a file system or a swap space, but on Ubuntu you can choose between many different file systems. But those aren't Ubuntu-filesystems. And they don't use swap partitions. Ubuntu installations might use swap partitions, and on one system, you just need one of them. – user unknown Aug 31 '11 at 23:06
  • I mean partitions with Ubuntu installed on them. I can't see what else it would mean. – Echogene Sep 1 '11 at 17:48
  • It is quiet common to have at least 2 partitions for a single Linux-Desktop-Installation: Swap and everything else; maybe +/home and sometimes even more. I would have written 'I have 2 Ubuntu installations on different partitions, each with an own swap partition.' – user unknown Sep 1 '11 at 18:01
  • If possible, please consider closing some of your other open questions by selecting the best answer (if they have one). Consider which answers have been useful and need an upvote. We need users to maintain their questions so that the site can be an effective tool for the next person with your problems. For more details on best practices consider reading the FAQ on asking questions. – nanofarad Jun 16 '12 at 15:29

It's a waste of space - when installing the second Ubuntu you could've just pointed it to the existing swap partition. Actually, I even think the installer automatically configures an existing swap partition to be used if it can find one.

To fix the situation (well, if you consider it a problem), you need to open /etc/fstab file of one of the ubuntus, locate the line which mentions "swap" and change the device name (or partition UUID) there.

The line would look something like

# /dev/sda2
UUID=69222dd6-31ea-488e-a4c1-8f5a5fbba098 none            swap    sw              0       0

so you can change it to

/dev/sdb5 none            swap    sw              0       0

or, even better, find the UUID of the swap partition and use it instead:

sudo blkid /dev/sdb5
/dev/sdb5: LABEL="SWAP-sdb5" UUID="69222dd6-31ea-488e-a4c1-8f5a5faac456" TYPE="swap"
  • I guess you're right in interpreting the question. 2 Ubuntu-partitions... – user unknown Aug 31 '11 at 23:08
  • I have used the installer several times now across a few machines installing more than one Ubuntu on them. Unfortunately, it has never automatically used an already existing swap partition. – Echogene Sep 1 '11 at 17:53
  • @Echogene - that's surprising because when you boot from a LiveCD it automatically finds and uses any swap partitions it can find on the hard drive. So this definitely is considered safe - I suppose it's just an omission in the installer's auto-partitioning algorithm. Anyway, you always can specify swap partitions manually when installing. – Sergey Sep 1 '11 at 23:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.