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.
|
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* |
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) |
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. |
Quote:
|
I thought this will be useful. http://www.linux-tutorial.info/modul...ial&pageid=218
|
Quote:
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. |
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.
|
Quote:
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 |
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. |
Quote:
|
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 09:55 AM. |