To install various Linux distributions on the same physical machine, do I need to add a swap partition for each distribution, or one will suffice for all?
3 Answers
I assume you are asking about a swap partition.
Yes you can share a swap partition, but each time you install, the swap space will be reformatted. This will change the UUID of the swap partition and you will need to update /etc/fstab in each installed os.
sudo nano /etc/fstab
You will see an entry similar to:
UUID=cee15eca-5b2e-48ad-9735-eae5ac14bc90 none swap sw 0 0
List your partitions with
sudo blkid
and update fstab with the new UUID.
- 104,528
Maybe is solution to add swap like swapfile. You don't need partition for swap and each distribution have his swap.
Take space to make swap
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
Count is size of swapfile
create swap file system
mkswap /swapfile
Turn on swap
swapon /swapfile
End at the end change /etc/fstab
sudo nano /etc/fstab
add line
/swapfile none swap sw 0 0
- 10,758
Yes, but...
The big restriction if you share your swap across distros is that you will be unable to use hibernation/suspend-to-disk. This uses the swap space to store the current contents of RAM, and if you boot into one distro while another is hibernating, it'll clobber the hibernation information.
(Mixing hibernation and dual-booting is a bad idea in general, because the hibernated data may include cached information about the contents of the hard drive, and the actual contents of the drive may change if you boot into one OS while another is hibernated.)
- 1,054