Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  hexafraction Jun 16 '12 at 15:29
add comment

1 Answer

up vote 3 down vote accepted

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"
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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