From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael French" Subject: Re: a swap partition utilization question Date: Tue, 25 Nov 2003 13:46:32 -0800 Sender: linux-admin-owner@vger.kernel.org Message-ID: <002d01c3b39d$98434a50$0a9f0c0a@savvis.ad.savvis.net> References: <001d01c3b31a$c003ec30$2a02010a@avwindows> <3FC3C0BC.6AC601E7@gelm.net> <3FC3CC77.5010008@fi.uba.ar> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: List-Id: Content-Type: text/plain; charset="iso-8859-1" To: linux-admin@vger.kernel.org From a website I found: http://www.netadmintools.com/art1.html by Urbana Der Ga'had Sometimes in the course of a system's existence you find that the swap partition you set up at install-time just isn't enough anymore. Maybe y= ou're upgrading your system to RedHat 7.1 from a version of RedHat that used = less swap in relation to physical RAM. Perhaps you're running Oracle. Or may= be you're adding more memory and would like to increase swap space accordi= ngly. Our machine goblin is swapping like mad and we just can't take it down = right now to add more RAM. So to keep the machine from running out of memory entirely and freezing, we'll add 128 MB more swap space by creating a s= wap file. =46irst we check out the memory usage: [root@goblin /root]# free -m total used free shared buffers cach= ed Mem: 251 242 8 22 11 = 32 -/+ buffers/cache: 198 52 Swap: 133 133 0 Make sure we have 128 MB laying around somewhere: [root@goblin /root]# df =46ilesystem 1k-blocks Used Available Use% Mounted on /dev/hda9 132207 33429 91952 27% / /dev/hda1 15522 2537 12184 17% /boot /dev/hda6 6143236 739000 5092176 13% /opt /dev/hda7 1035660 836204 146848 85% /usr /dev/hda5 2071384 344048 1622112 17% /usr/local /dev/hda8 303344 14439 273244 5% /var OK, we're going to make a swap file in /opt by using dd to create a fil= e 128 MB in size. [root@goblin /opt]# dd if=3D/dev/zero of=3Dswapfile bs=3D1024 count=3D1= 32207 132207+0 records in 132207+0 records out [root@goblin /opt]# ls -l total 132364 drwxr-xr-x 20 brenda users 4096 May 22 10:46 brenda drwxr-xr-x 2 root root 16384 Feb 21 07:04 lost+found -rw-r--r-- 1 root root 135379968 May 29 11:52 swapfile Hey, I know, let's not make it world-readable... [root@goblin /opt]# chmod 600 swapfile [root@goblin /opt]# ls -l total 132364 drwxr-xr-x 20 brenda users 4096 May 22 10:46 brenda drwxr-xr-x 2 root root 16384 Feb 21 07:04 lost+found -rw------- 1 root root 135379968 May 29 11:52 swapfile Now we set up the swap area and enable it. [root@goblin /opt]# mkswap swapfile Setting up swapspace version 1, size =3D 135372800 bytes [root@goblin /opt]# swapon swapfile And viola! Twice as much swap as before. [root@goblin /opt]# free total used free shared buffers cached Mem: 257632 254632 3000 2512 36172 150= 96 -/+ buffers/cache: 203364 54268 Swap: 268708 136512 132196 You can edit /etc/fstab to enable your swap file automatically at boot = time. By adding an entry like this: /opt/swapfile swap swap defaults 0 0 Sure, swapping's ugly, slow and will grind your hard drives to dust. Bu= t even modern systems which have been tuned for performance require a gen= erous oodle of swap space. Michael French ----- Original Message -----=20 =46rom: "Dar=EDo Mariani" To: Sent: Tuesday, November 25, 2003 1:41 PM Subject: Re: a swap partition utilization question > Try creating a program that consumes 90% or more of the physical memo= ry. > > chuck gelm net wrote: > > Hi, Bill: > > > > Perhaps swap memory will not be used until > > all physical memory has been consumed. > > > > HTH, Chuck > > > > "Bill J.Xu" wrote: > > > >>Hello everyone, > >> > >>After booting my linux box,I add a swap partition using "swapon /dev/hda5".but I found that swap partition was nerver used even 2M phys= ics memory left. > >> > >>why? > >> > >>thanks > >> > >>Bill > >>- > >>To unsubscribe from this list: send the line "unsubscribe linux-adm= in" in > >>the body of a message to majordomo@vger.kernel.org > >>More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > > > - > > To unsubscribe from this list: send the line "unsubscribe linux-adm= in" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > > - > To unsubscribe from this list: send the line "unsubscribe linux-admin= " in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > - To unsubscribe from this list: send the line "unsubscribe linux-admin" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html