Solved

Repartition swap

Posted on 2003-11-05
12
407 Views
Last Modified: 2013-12-16
My harddisk has 20GB, with 256MB ram.
Recently I added 256MB to it, so I want to increase the size of swap partition from 512MB to 1024MB. But i have partitioned all space in the harddisk. Any suggestions to achieve this?
0
Comment
Question by:takwing
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9692449
0
 
LVL 12

Accepted Solution

by:
paullamhkg earned 25 total points
ID: 9692460
So do you have another Harddisk can add in? if no, you need to resize some of your existing partitions to get space for increase the swap. have a look here for repartition your harddisk without loosing the data http://www.europe.redhat.com/documentation/HOWTO/PLIP-Install-HOWTO-11.php3 (this is free), or you can use the partition magic or partition manager (those are not free). you can also using those to increase the size of you swap space.

if you have another harddisk, it's more easier, just add the extra harddisk into your linux box, after that, use the fdisk to create the swap partition, after that change your /etc/fstab

/dev/hda7               swap                    swap    defaults        0 0    <--- original entry

change to

/dev/hdc1               swap                    swap    defaults        0 0     <--- the new swap and I assume you have the new harddisk plug into seconday IDE slave

That it.
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9692472
yuzh, no offence, the link you show here is talking about someone didn't have the partition, and try to create one, but takwing already have the partition, just need to increase it. but takwing do need the mkswap to format the swap partition after the swap partition created of my second suggestion (using another harddisk)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Assisted Solution

by:Omeger
Omeger earned 25 total points
ID: 9693418
It is possible to create a swapfile.
Example:
To create a swapfile in current dir of 512MB:
[root@ee /opt]# dd if=/dev/zero of=swapfile bs=1M count=512
(This has created the file /opt/swapfile)
To modify it so that it is not world-readable:
[root@ee /opt]# chmod 600 swapfile
Enabling the swap area:
[root@ee /opt]# mkswap swapfile
[root@ee /opt]# swapon swapfile

Now you can enable it at boot time by editing your /etc/fstab:
(adding something like this)
/opt/swapfile swap swap defaults 0 0

0
 

Expert Comment

by:Omeger
ID: 9693432
You will probably first want to check if you have enough space on your harddisk.
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9698284
Omeger no offence, takwing already said "But i have partitioned all space in the harddisk" most likely takwing got no space for the new partition, that why I suggest to use the repartition tools or add a new harddisk.

takwing, am I right? more info will help us to give out suggestion :)
0
 
LVL 9

Expert Comment

by:majorwoo
ID: 9698769
paullamhkg

omeger's solution does not make a partion, but instead a swapfile inside of the file (filesystem inside a file)
so he could place it on whatever partiton he has space on
0
 

Author Comment

by:takwing
ID: 9698770
paullamhkg is rite. I have no space left.
And thanks for suggesting repartition tools to resize my root partition and swap partition.
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9698853
Yes, I understand Omeger's solution after majorwoo comment, I'm sorry Omeger.

takwing, Omeger give you hint on instead of create a swap partition or resize your partition, this is another work around solution is create a swapfile and make use of the swapfile to become your swap. his example is assuming your partition of /opt have space for create a swapfile so create a swapfile inside /opt "dd if=/dev/zero of=swapfile bs=1M count=512" this will create a swapfile inside /opt called /opt/swapfile and the size is 512MB, afterward format the /opt/swapfile as swap 'mkswap /opt/swapfile', and make it alive 'swapon /opt/swapfile', up to this point you will have a new swap space and it is 512MB.

and Omeger also show you how to create the mount point at the /etc/fstab, so that everytime you reboot/restart the new swap space will mount up and turn on as swap.

the only difference is you will use up some of the diskspace of other partition.

Everything will be on your only choice. But sure this is good to learn :)
0
 
LVL 2

Expert Comment

by:sam_sunder
ID: 9770655
Hello Takwing,

There is no need to create a new partition. You can use the existing partion provided there is free space by just creating a swap file.
follow the steps which omeger  gave. That will work fine. I  think it is not a must for you to create swap partition because
you have a very good RAM.  Go for it if you are using it as a heavy duty server.

regards,

sam
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Zimbra on Amazon Linux help 7 115
centos linux 65 192
fedora linux on laptop - setup sendmail - or some kind of email 5 66
SMB share across internet 15 84
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question