SWAP partition on second hard drive

Forum rules
Before you post please read this
Subramanian Pandath
Level 1
Level 1
Posts: 1
Joined: Tue Nov 21, 2017 11:58 am

SWAP partition on second hard drive

Postby Subramanian Pandath » Tue Nov 21, 2017 1:08 pm

Sir.
I recently installed Linux mint.
I have two Hard drives on my desk top.
How can I have a SWAP partition on my second hard drive for 4GB.
Existing drive is having 2GB by default during installation and Iam unable to increase it.
Iam new to linux and please suggest solution using Gparted.
My RAM is 2GB.

User avatar
WharfRat
Level 20
Level 20
Posts: 10274
Joined: Thu Apr 07, 2011 8:15 pm

Re: SWAP partition on second hard drive

Postby WharfRat » Tue Nov 21, 2017 5:38 pm

Hello Subramanian Image

Welcome to Linux Mint and the Linux Mint forum :)

You can use gparted to create a swap partition by formatting it linux swap from the format options.

In order to use it you'll have to edit /etc/fstab and change the existing swap partition designation to the new one.
Image ImageImage

User avatar
coffee412
Level 5
Level 5
Posts: 732
Joined: Mon Nov 12, 2012 7:38 pm
Location: Indiana, USA
Contact:

Re: SWAP partition on second hard drive

Postby coffee412 » Tue Nov 21, 2017 5:39 pm

Hello.

Create a partition on the second hard drive of the size you want your swap partition to be. I dont use gparted as often as I should but you should see a option during the creation of the partition as to what type it should be. Its should be 'swap'.

Then turn your swap off in linux by this command:

Code: Select all

sudo swapoff -a


Then edit your /etc/fstab file to reflect the change in the partition of the swap partition. You will see a line there mentioning the swap partition. Change the drive location only.

ADDED MORE HERE: After making the change to the swap partition location in fstab you will want to remount the filesystem I do believe:

Code: Select all

sudo mount -a

Then turn swap back on:

Code: Select all

sudo swapon -a


That should do it. BTW -- swap as I recall should be approximately twice the amount of ram that you have.
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
IceWarp * Samba AD * Mint 18.1 * RAID 1/5 * OpenVPN * Linux since kernel 2.0.36

mr_raider
Level 6
Level 6
Posts: 1282
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: SWAP partition on second hard drive

Postby mr_raider » Tue Nov 21, 2017 6:14 pm

To the drive "designation" you need the UUID, since partitions are like Borg, they don't have names, only numbers.

get the uuid with

Code: Select all

sudo blkid
Image


Return to “Mounting Partitions”