LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-29-2005, 11:26 PM   #1
shujja
LQ Newbie
 
Registered: May 2005
Posts: 20

Rep: Reputation: 0
Resizing swap partition


hi everbody,

I am using redhat9. I kept swap partition 1.50GB at the time of installation. Now i want to resize this partition to 500MB from 1.50GB. what should i do.

thanks in advance
 
Old 09-29-2005, 11:35 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
First, decide whether you should decrease the size from the front end so that the free space can be added to the preceding partition, or decrease the size from the backend to add the free space the the partition after the swap partition.

Then use cfdisk to resize the swap partition, and add the free space to another partition.

Important note: it would be advisable to close all applications currently running which may have files in swap space (perhaps open a terminal window and issue the command 'init S' to get to single user mode). That way, you can assure that you don't loose data in swap space. Then run cfdisk to resize the swap partition.

Last edited by bigrigdriver; 09-29-2005 at 11:37 PM.
 
Old 09-30-2005, 02:07 AM   #3
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,606

Rep: Reputation: 53
I imagine you would need to umount the swap partition as well
before doing anything, maybe
 
Old 09-30-2005, 02:20 AM   #4
SkyEye
Member
 
Registered: Sep 2005
Location: Sri Lanka
Distribution: Fedora (workstations), CentOS (servers), Arch, Mint, Ubuntu, and a few more.
Posts: 441

Rep: Reputation: 40
First you need to do a
Code:
swapoff
This will disable swap spaces listed in fstab. Then use a tool like parted to resize the partition.
Code:
parted
This is your choice to select the tool. parted is available in RH/Fedora systems by default.

After you resize the partition then
Code:
mkswap /dev/hda4
Here replace hda4 with the name of your swap partition device. Then
Code:
swapon
If you did was resize this would work. But if your editing changed the device name, you might have to change the /etc/fstab.

All these can usually be done without the need of rebooting and without changing runlevels.

Last edited by SkyEye; 09-30-2005 at 02:22 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting/resizing swap partition / increasing hd space saranga2000 Linux - Hardware 1 12-09-2004 10:03 AM
Resizing a swap file rhmd5 Linux - General 5 01-11-2003 12:40 PM
Resizing Swap Partition Staz Linux - General 4 08-30-2002 12:33 PM
Resizing swap partition... PapaLewA Linux - Newbie 4 11-17-2001 01:59 PM
I'm an idiot...please help me with resizing my swap partition totalcommand Linux - Newbie 8 10-18-2001 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration