LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-24-2004, 12:17 PM   #1
kemplej
Member
 
Registered: Dec 2003
Posts: 235

Rep: Reputation: 30
Resize a Partion from a Command Line


I was recently put in charge of a email server on linux2.4.26 running Slackware 10. The person who installed the server put in a 18.2gb scsi drive. He partioned only 200 megs for the swap. Right now the pc is a bit bogged down and according to mrtg its using most of its swap. Since I am only using 18% of the rest of the HD (not counting the 200 megs for swap) I was wanting to snip 500 megs or so off the / partion and increase the swap. Is this possible due to on the command line since I dont have any xwindows on the server?


Thanks

Justyn
 
Old 08-24-2004, 01:25 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
You could do it using parted. I really wouldn't like to go about resizing partitions on a live server though. If your swap is full then I would reccommend getting a big RAM upgrade.
 
Old 08-24-2004, 04:31 PM   #3
kemplej
Member
 
Registered: Dec 2003
Posts: 235

Original Poster
Rep: Reputation: 30
I dont like the idea of doing it on a live server either. Changing swap size seemed a cheaper alternative to more ram though not as easy. The server load is fine for now but I can just see this becoming a bigger problem in the future.


Justyn
 
Old 08-25-2004, 12:33 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Remember that when you use swap you are paging to disk so it will take more of a performance hit using swap than RAM. Memory prices have really been falling in recent years.
 
Old 08-26-2004, 12:11 PM   #5
kemplej
Member
 
Registered: Dec 2003
Posts: 235

Original Poster
Rep: Reputation: 30
Is there a reason why mrtg would show my swap use as being maxed but ram has hardly been hit?




Justyn
 
Old 08-26-2004, 04:33 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
That would sound really odd. Your ram should be well into the 90% range before the swap is being used. Can you post the output from:
free -mlt

Last edited by david_ross; 08-26-2004 at 04:34 PM.
 
Old 08-26-2004, 04:40 PM   #7
Ulisses
LQ Newbie
 
Registered: Aug 2004
Location: Recife/PE, Brasil
Distribution: Kubuntu Breezy
Posts: 13

Rep: Reputation: 0
Swap Files

Well, you don't need to resize or add another partition in order to provide more swap space -- you can do with a swap file. Performance will definitely take a hit, because you will not be using raw disk blocks but rather filesystem area (which deals with a lot more metadata), but the end result will be the same -- more room for your server to breathe.

Check out http://www.redhat.com/docs/manuals/l...ap-adding.html

Quote:
To add a swap file:

1. Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.
2. At a shell prompt as root, type the following command with count being equal to the desired block size:

dd if=/dev/zero of=/swapfile bs=1024 count=65536

3. Setup the swap file with the command:

mkswap /swapfile

4. To enable the swap file immediately but not automatically at boot time:

swapon /swapfile

5. To enable it at boot time, edit /etc/fstab to include:

/swapfile swap swap defaults 0 0

The next time the system boots, it will enable the new swap file.
6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.
 
Old 08-31-2004, 10:08 AM   #8
kemplej
Member
 
Registered: Dec 2003
Posts: 235

Original Poster
Rep: Reputation: 30
Sorry lost internet access for a bit.

total used free shared buffers cached
Mem: 313 269 44 0 123 18
Low: 313 269 44
High: 0 0 0
-/+ buffers/cache: 126 186
Swap: 282 77 204
Total: 595 346 248
 
Old 09-01-2004, 04:05 PM   #9
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Code:
             total       used       free     shared    buffers     cached
Mem:           313        269         44          0        123         18
Low:           313        269         44
High:            0          0          0
-/+ buffers/cache:        126        186
Swap:          282         77        204
Total:         595        346        248
That shows that you have over half of your swap free,
 
Old 09-02-2004, 08:30 AM   #10
kemplej
Member
 
Registered: Dec 2003
Posts: 235

Original Poster
Rep: Reputation: 30
Well thats a little better then what I thought Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Partition resize, YAST2 (Suse 9.0) command line onurbi Linux - Software 4 08-18-2010 03:58 AM
partion resize problem KAMI no kodomo Linux - Newbie 3 03-15-2005 04:24 PM
Which software could resize my hd partion without lose data? amumu Linux - Software 2 03-29-2004 09:42 PM
What can I use to resize jpegs via script/command line? davee Linux - Newbie 2 11-03-2003 02:23 AM
Resize partion stardock Linux - Software 1 06-19-2001 03:48 AM


All times are GMT -5. The time now is 06:15 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration