[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] Making a swapfile
- Subject: [cobalt-users] Making a swapfile
- From: Gerald Waugh <gwaugh@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon Sep 9 18:50:01 2002
- Organization: Front Street Networks LLC
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
My system has 512MB memory, I want a 1GB swapfile
This is the method I use to create the swapfile
#### look at meminfo ####
[root tmp]# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 529395712 521211904 8183808 83701760 375746560 16183296
Swap: 237297664 2347008 234950656
MemTotal: 516988 kB
MemFree: 7992 kB
MemShared: 81740 kB
Buffers: 366940 kB
Cached: 15804 kB
*SwapTotal: 231736 kB*
SwapFree: 229444 kB
#### Check current swaps ####
[root tmp]# cat /proc/swaps
Filename Type Size Used Priority
/dev/md6 partition 231736 1804 -1
#### cd to /home/tmp ####
[root tmp]# cd /home/tmp
#### create the swap file, using dd insures no holes ####
[root tmp]# dd if=/dev/zero of=swapfile bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
#### execute 'mkswap; ####
[root tmp]# /sbin/mkswap -c -v1 /home/tmp/swapfile
Setting up swapspace version 1, size = 1073737728 bytes
#### execute swapon (enable it) #####
[root tmp]# /sbin/swapon /home/tmp/swapfile
#### Check current swaps again ####
[root tmp]# cat /proc/swaps [Current Swaps]
Filename Type Size Used Priority
/dev/md6 partition 231736 1804 -1
/home/tmp/swapfile file 1048568 0 -2
#### I now have ~1.2 GB swap memory... ####
#### Now fix it so the swap file gets started on boot ####
[root tmp]# cp /etc/rc.d/rc.sysinit /etc/rc.d/rc.sysinit.save [backup]
[root tmp]# vi /etc/rc.d/rc.sysinit
#### look for these lines ####
# Start up swapping.
action "Activating swap partitions" swapon -a
#### comment out the line beginning with action ####
#### modify this section as ####
# Start up swapping.
#action "Activating swap partitions" swapon -a
action "Activating swap partitions" swapon -a swapon /home/tmp/swapfile
#### Save the file ####
#### DONE ####
#### look at meminfo ####
[root tmp]# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 529395712 522534912 6860800 82948096 377397248 15179776
Swap: 1311031296 2347008 1308684288
MemTotal: 516988 kB
MemFree: 6700 kB
MemShared: 81004 kB
Buffers: 368552 kB
Cached: 14824 kB
*SwapTotal: 1280304 kB*
SwapFree: 1278012 kB
it may slow your system down, but a slow system is better than a broken one
(crash)!
And then it again it may never need that much swap memory, but if it does!!!
I have implemented the above on all of my RaQs
Gerald
--
http://frontstreetnetworks.com http://raqware.com
229 Front Street, Ste C, New Haven, CT 06513-3203
Phone: 203-785-0699