Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-14-2005, 10:38 PM
|
#1
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Rep:
|
Change the swap size
I hv newly setup the RH linux , it use auto partition method to install , I didn't define the swap partition size , if I want to install its size , is it possible ? if yes , how to do it ? thx.
|
|
|
06-15-2005, 12:29 AM
|
#2
|
Member
Registered: Aug 2004
Location: Bangalore
Posts: 64
Rep:
|
use fdisk to create the swap partition( command t will ask for swap-id, give 82 for linux swap ).
and then do
mkswap /dev/hda*
swapon /dev/hda*
|
|
|
06-15-2005, 06:37 AM
|
#3
|
Member
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69
Rep:
|
the seran's answer is correct only if there left some free space (i don't think it is!). If your harddisk is fully partitioned you need to find some way to resize(or simply delete) some partition. More easier way is to create swap file:
dd if=/dev/zero of=/swapfile bs=1K count=<desired size in Kb>
mkswap /swapfile
swapon /swapfile
if you don't wish to tell "swapon /swapfile" every time you boot modify your /etc/fstab file and add record similar to created by your setup program (in case of automatic partitioning it usually exists)
|
|
|
06-15-2005, 07:24 AM
|
#4
|
Member
Registered: Aug 2004
Location: Bangalore
Posts: 64
Rep:
|
Creating a swapfile instead of using a partition on the disk, is a good idea.
I tried creating a swapfile on my machine. I had a swap partition on /dev/hda2. I deleted this partition and added the swapfile entry inside /etc/fstab. I rebooted the machine and I saw this error message on the terminal.
Enabling swap partitions: could not create swap partition /swapfile [ERROR]
In the shell prompt I gave
mkswap /swapfile
swapon /swapfile
and then rebooted again. Then I got
Enabling swap paritions: [OK]
This worked fine for me.
So, I can use my /dev/hda2 partition for other purposes. This will be helpful if there is not enough space to create a swap partition on the disk. Today I am happy, I learned a new thing.
|
|
|
06-15-2005, 07:45 AM
|
#5
|
Member
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69
Rep:
|
Quote:
Originally posted by seran
I rebooted the machine and I saw this error message on the terminal.
Enabling swap partitions: could not create swap partition /swapfile [ERROR]
|
That's right: you can't use swap without "mkswap" first. It initializes a file/device so it cat be used as swap.
|
|
|
06-15-2005, 08:11 AM
|
#6
|
Member
Registered: Aug 2004
Location: Bangalore
Posts: 64
Rep:
|
|
|
|
06-15-2005, 02:51 PM
|
#7
|
LQ Newbie
Registered: Jan 2005
Distribution: Debian, testing
Posts: 19
Rep:
|
Quote:
Creating a swapfile instead of using a partition on the disk, is a good idea.
|
It depends. Keeping the swap on a file is slower than on a partition. You will note the difference if you start using it often.
If you almost never use the swap, otherwise, you may choose to lose some speed (and response time) on those rare occasions and get a simpler partition scheme.
|
|
|
06-16-2005, 12:25 AM
|
#8
|
Member
Registered: Apr 2005
Distribution: Slackware
Posts: 350
Rep:
|
so..... i dont get it. you had a swap partition, on /dev/hda2 made by redhat, and you switched to a swapfile which is slower cause it uses the filesystem of the partition it is on, i think,,, and so now what with your swap partition. that makes no sense.!?!? did i miss something. that is like putting your root partition on a cd so you can just have an unused root partition on the harddrive.
|
|
|
06-16-2005, 01:11 AM
|
#9
|
Member
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69
Rep:
|
Quote:
Originally posted by edong23
so now what with your swap partition. that makes no sense.!?!? did i miss something.
|
1) it still can be used as swap-space
2) it can be formatted and used as a place for other files (not neccessary swap)
3) if you have 256Mb or more RAM Linux as a rule uses swap very rarely, so there is almost no speedup when using partition instead of file
|
|
|
06-16-2005, 02:23 AM
|
#10
|
Member
Registered: Apr 2005
Distribution: Slackware
Posts: 350
Rep:
|
as a rule huh. you must not use your linux box for what it is intended for. looong uptime, free software to do extensive audio and video encoding and ripping, multitasking ( like me downloading movies, while ripping mp3s, while encoding another movie, while instant messaging, while checking the forums, while playing the linux version of doom3, while downloading the linux version of quake, while also using another peer2peer to download the crack to the windows version of quake so that i may use the linux version, and all the while compiling the new 2.6.11.12 kernel. this is what i am doing right this minute, and yes i am accessing my swap space... i have 768MB Rambus mem@800mhz and i always make sure that my linux systems have at least a gig of swap. you dont want to sell yourself short incase you actually want to do something memory intensive. but anyway i jsut didnt understand y you wanted to have a swap file in place of a swap space.
btw. my uptime is 72 days 17 hours 46 minutes can you imagine? my mother is bound to kick the bucket real soon with all i put it through.
|
|
|
06-16-2005, 03:18 AM
|
#11
|
Member
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69
Rep:
|
Quote:
Originally posted by edong23
but anyway i jsut didnt understand y you wanted to have a swap file in place of a swap space.
|
I just advised to create swap file instead of resizing partitions, because it is simplier.
|
|
|
06-16-2005, 11:04 PM
|
#12
|
Member
Registered: Apr 2005
Distribution: Slackware
Posts: 350
Rep:
|
well yeah. it is sound advice. it is easier, but like i said i was confused as to y the user that posted the question.
|
|
|
All times are GMT -5. The time now is 01:10 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|