SWAP partition on second hard drive

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Subramanian Pandath

SWAP partition on second hard drive

Post by Subramanian Pandath »

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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
WharfRat

Re: SWAP partition on second hard drive

Post by WharfRat »

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.
User avatar
coffee412
Level 8
Level 8
Posts: 2259
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: SWAP partition on second hard drive

Post by coffee412 »

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
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
mr_raider
Level 7
Level 7
Posts: 1897
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: SWAP partition on second hard drive

Post by mr_raider »

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
Locked

Return to “Storage”