On Fri, 2004-02-27 at 16:44, Amit Sharma wrote: > hi, > > i have rh 8.0 installed with 512MB RAM. > > > swap space is 2 GB (i.e. 4 times that of RAM, where as > ideally it should be twice.) > > > how can i reduce the size of swap partition?
Ok the following method has been tested on a testing machine about which I do not care at all. You may follow this at your own risk :D Best procedure is to get a cd of the distro you have installed. Boot into rescue mode(if it has anything like that) and follow from step 3 onwards. If you want to do it on a running pc that can also be done but is slightly more dangerous like I found out when I tried it. Maybe not dangerous to the file system but more to the running processes. It killed evolution, mozilla (4 instances), yahoo msg and xmms when I tried to disable swap space usage by swapoff. If using a running system first off go to init 3. That means a console (Ctrl+Alt+F[1-6]) go there and issue "init 3". 1. swapoff -a -- To disable using the swap partition. But it disables only those partitions listed in /etc/fstab as swap or those currently present in /proc/swaps. If for some insane reason your swap partition is not listed in either of these dunno. 2. Check to see that the swap partition is no longer being used Output of free before swap partition is disabled [EMAIL PROTECTED] root]# free -m total used free shared buffers cached Mem: 241 230 11 0 4 41 -/+ buffers/cache: 184 56 Swap: 1027 281 745 Output of free after disabling swap partition [EMAIL PROTECTED] root]# free -m total used free shared buffers cached Mem: 241 230 11 0 4 41 -/+ buffers/cache: 184 56 Swap: 0 0 0 The remaining numbers are immaterial the important thing is to see that the last line in front of Swap are all zeros. 3. fdisk /dev/hd? (put hda or hdb etc depending on your system) You can find out which hdd the swap is on and also the partition number using "fdisk -l /dev/hd[a-f] | grep swap". Hmmm six hdd's should cover your situation. If you do not get any output replace [a-f] with [a-z] :-). But if you get the following output [EMAIL PROTECTED] root]# fdisk -l /dev/hd[a-f] | grep swap /dev/hda7 9602 9732 1052226 82 Linux swap The fdisk command will be fdisk /dev/hda At the fdisk prompt use "d" to delete it will ask for partition number in this case it will be 7. Then use "n" to create a new partition and assign it 128M or whatever you want the new swap partition size to be. Then use "t" to assign the id to it. It will ask for partition number give it the number of the partition you have just created. Swap has id of 82. So on being prompted for id give it 82. Create another partition using "n" to use up the space you just freed up and do whatever you want with it. Check using p that everything is well and fine. Double check again. Use "w" to save and exit. 4. mkswap /dev/hda? -- replace with whatever partition you created in the previous step. 5. Make changes to /etc/fstab in case you have changed the partition. So if you have changed /dev/hda7 to say /dev/hda8 or something reflect this change in the /etc/fstab file also by changing the appropriate line. 6. This command is required if you are making the changes on a running system if using rescue mode then this is not required. swapon -a -- To reactivate the swap partitions. 7. If using rescue mode then reboot. 8. Finally check using the "free -m" command and see that that the output in front of the swap line is not all zeros. If not then rejoice with the almost 1.8 GB of space you have just freed on your system but if still zero don't blame me :D and ask again on this list. Regards, -- Arindam Dey The mind is not a vessel to be filled but a fire to be kindled. GPG FPR: B8E3 219E F129 F970 F4A7 BC50 9636 504A BEDF 5739 _______________________________________________ ilugd mailinglist -- [EMAIL PROTECTED] http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/[EMAIL PROTECTED]/