New installation coming up. 120gb SSD for OS and HOME and 1tb HDD for storage. 16gb of ram which means 16gb of swap if I recall correctly. SSD space is too valuable for a swap partition right? If my thinking is correct can someone guide me through or point me in the right direction for putting a swap partition on a second hard drive? I have always selected the automatic settings when installing ubuntu. Thanks!
Swap – Put Swap on SSD or HDD?
hard driveinstallationpartitioningssdswap
Related Solutions
Please, don't do anything until someone else reviews it. I could miss something.
As /home
is already configured, move /usr/share
- Using a live CD, start gparted
- Unmount swap, lvm's and any mounted partitions
Resize the partition you like to get space from, apply
If that partition is so big, try removing space from the end. So gparted will not shift the whole partition.
- Create the needed partition as ext4, apply
- Still using gparted: Right click on the new partition → Properties → Copy UUID
- Mount the created (share) partition with the ubuntu partition which gonna copy from
Copy share folder.
cp -a
to preserve all (permissions, ownership, links..)Replace
<ubuntu_part>
and<share_part>
with your partitions mounting pathssudo cp -a /media/<ubuntu_part>/usr/share/* /media/<share_part>/
Rename
/usr/share
as backupsudo mv /media/<ubuntu_part>/usr/share /media/<ubuntu_part>/usr/backup_share
Backup
/etc/fstab
sudo cp /media/<ubuntu_part>/etc/fstab /media/<ubuntu_part>/etc/backup_fstab
Same as
/home
add/usr/share
, (use UUID copied before) something similar to:sudo gedit /media/<ubuntu_part>/etc/fstab # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=e3725608-ee2f-408d-9d53-4f172070ca1f / ext4 errors=remount-ro 0 1 # /home was on /dev/sda5 during installation UUID=1063be7e-2105-434c-a9e9-75cf3d02e969 /home ext4 defaults 0 2 # /usr/share was on /dev/sda6 during installation UUID=34c6fc4b-3c63-4e58-a3dd-3b70926c58c9 /usr/share ext4 defaults 0 2 # swap was on /dev/sda2 during installation UUID=bde0f592-e4fe-4eb6-9d75-eec161e349a1 none swap sw 0 0
Lines starts with # are just comments
Reboot
If it's OK, delete backups
sudo rm /media/<ubuntu_part>/etc/backup_fstab sudo rm -R /media/<ubuntu_part>/usr/backup_share
Note:
- Disk Usage Analyzer (or
du
on command line) can be used get size info. It is more practical to analyze an already used system so all tools needed installed. So space distribution depends on user behavior, some install much -doc's, -dev's, wine programs in/home/user/.wine
, ...
Installing the /
partitioning on the SSD instead of on the HDD will give much better performance and stability, but your partitioning scheme is too complicated and there's not enough space in /
. At least 25GB is recommended for /
and you'll probably need more than that. We can discuss the exact amount of /
that is required. All you need is / and optionally swap and /home
, but in new installations of Ubuntu 17.04 and later a swap file is created instead of a swap partition, so you don't need a swap partition either.
The more information that you provide, the more specific the recommendation can be. Let's start with a general recommendation. SSDs are rugged and durable so read and write cycles is not the most important issue. Disk space on an SSD is expensive compared to disk space on an HDD so it's important to conserve valuable space on the SSD by not cluttering it with unnecessary partitions.
Best Answer
A swap partition on your SSD will let you wake up faster from hibernation (aka "suspend to disk") as compared to swap on a hard drive. But given the incredibly fast boot time of Ubuntu when booting from SSD a wake up from hibernation may be slower than a reboot.
If you do not hibernate you may never need to swap at all.
Only in case you often have very many RAM intensive applications running in parallel, your system may eventually use swap. Then a swap on SSD will be somewhat faster than a swap on a hard drive. Still there is no need to worry about wearing of your SSD from extensive swapping.
If not used for hibernation you can alway add a swap partition or swap on file later: