How to allocate swap space?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to allocate swap space?
# 1  
Old 05-01-2008
How to allocate swap space?

Hi all,

I would like to know how i can mount swap on /tmp at boot time,
I mean even before the actual script that does the mounting kicks in?
i tried this
mount -F tmpfs swap /tmp
(nothing happens it just hangs during the booting)

I also tried this
/usr/lib/fs/tmpfs/mount swap /tmp
(says mount not allowed for this FSType)

Thanks
# 2  
Old 05-01-2008
You didn't mention which OS you are working on, but on the systems i know you cannot "mount" a swapspace at all! To "mount" means "to make part of the filesystem hierarchy" and swap space is neither part of this hierarchy nor intended to be. To mount anything there would have to be a filesystem on it but a swapspace is a raw device. There is now FS on it at all.

There is a feature in Linux where swapspace can be allocated in the filesystem by creating a "swap file" (like it is the case in Windoze systems), but this is somewhat a stretch to the concept of swap: Basically it means to first create a file to set aside space, emulate a sort-of logical volume (~= partition) on it (similar to the "drives" files in VMware) and then use this pseudo-partition as a swapspace. Still, this is EMULATION all over and doesn't change the original concept: swap space is not to be mounted.

The reason why "mount -F" will hang at boot time is simple: you force the mount so the system will not continue if the mount fails. As this mounting attempt must fail it will definitely hang.

I hope this helps.

bakunin
# 3  
Old 05-01-2008
I am using opensolaris.
Can you help me figure it out now?
By mounting i mean..
trying to mount swap on /tmp at a earlier stage than its default script.
The whole point is that i need 2 lib files to reside in /tmp at a very early stage in the boot..
This is not happening because these files have combined size of 600mb...
This amount of ram is not allocated when the script where i want to copy 2 files to the ram is executed...

so i thought of explicitly mounting swap so that i get the whole ram at this point iteself(i'm having 2gb ram).

Can you please help!
# 4  
Old 05-01-2008
Example:
How to Add More Swap Space without Repartitioning the Disk


To add more swap space, perform the following steps:

Become superuser.

Create a directory for the swap file, if needed-for example:

mkdir /moreswap

Create the swap file by using the mkfile command, which has the following syntax:

mkfile <number> [k|b|m] <filename>

The <number> specifies the file size in KB, bytes, or MB specified by k, b, or m. For example, to create 500MB swap space, issue the following command:

mkfile 500m /moreswap/swapFile

Activate the swap file by carrying on the same example:

# /usr/sbin/swap -a /moreswap/swapFile

You must use the absolute path name to specify the swap file. The swap file is now added, and activated. It is available until the file system is unmounted, the system is rebooted, or the swap file is removed. The swap file will be automatically activated each time the system is booted, if you perform the next step.

Add the following entry for the swap file to the /etc/vfstab file, again using the running example:

/moreswap/swapFile - - swap - no -

Issue the following command to verify that the swap file has actually been added:

/usr/sbin/swap -l
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Swap space not getting used

CENT OS 5.8 server running with a huge java application which uses up all my ram (4GB) and requires excess of atleast 2GB.But the swap is not getting used up((8GB) of swap space left unused) leading a wierd error and stopping application to stop working. Any one here dealt with the same kind of... (2 Replies)
Discussion started by: shiek.kaleem
2 Replies

2. AIX

F7fa22c9 i o sysj2 unable to allocate space in file system

F7FA22C9 I O SYSJ2 UNABLE TO ALLOCATE SPACE IN FILE SYSTEM edit by bakunin: until you are willing to phrase a decent question i am unwilling to tolerate such a spammed thread here. - Thread closed - (0 Replies)
Discussion started by: ranjithm
0 Replies

3. Solaris

Swap space

Dear All, I have a swap space of 16G available in Sol 10. I have allocated it as a seperate file system. But when the RAM Is full used , the system gets rebooted and the swap is not being used,. Any reasons for this. Rgds Rj (5 Replies)
Discussion started by: jegaraman
5 Replies

4. Linux

How to reclaim the space which i used to increse the swap space on Xen,

Hi, i have done a blunder here, i increased the swap space on Xen5.6 server machine using below steps :- 1056 dd if=/dev/zero of=/root/myswapfile bs=1M count=1024 1057 ls -l /root/myswapfile 1058 chmod 600 /root/myswapfile 1059 mkswap /root/myswapfile 1060 swapon /root/myswapfile ... (1 Reply)
Discussion started by: apm
1 Replies

5. Solaris

Swap Space

Could someone please explain how you know how much swap space you have on your system. See below: # swap -s total: 8225048k bytes allocated + 4863488k reserved = 13088536k used, 4008032k available # swap -l swapfile dev swaplo blocks free /dev/dsk/c3t0d0s1 32,25 16... (2 Replies)
Discussion started by: jamba1
2 Replies

6. Solaris

Re-allocate disk space

I am running out of space, and would like to reallocate some "wasted" space. Here is what I see: > df -h Filesystem Size Used Avail Use% Mounted on /dev/dsk/c0t0d0s0 5.4G 4.5G 860M 85% / swap 2.0G 1.3M 2.0G 1% /etc/svc/volatile swap ... (4 Replies)
Discussion started by: ippy98
4 Replies

7. UNIX for Dummies Questions & Answers

allocate more space to /home

Hi all Is there a way to allocate more space to a partition? For example my /home is almost full , at 96% so can I move memory from lets say / to /home? df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 6190692 2571688 3304532 44% / /dev/sda2... (2 Replies)
Discussion started by: mcraul
2 Replies

8. UNIX for Advanced & Expert Users

How to re-allocate disk space on solaris 10

I am not very good at UNIX and seek help here. I tried to install Oracle 10g on a 64 bit Sun sparc machine with solaris 10 as OS. After I installed solaris 10, the current file system on the machine looks like this: /dev/dsk/c0t0d0s0 5104758 4854293 199418 97% / /devices ... (2 Replies)
Discussion started by: duke0001
2 Replies

9. AIX

swap space / paging space

how do you get the paging space reduced without rebooting the machine ? the os is aix (2 Replies)
Discussion started by: aaronh
2 Replies

10. UNIX for Dummies Questions & Answers

pageing space vs swap space

Hello, I would like to know if there is any difference between the pageing space and the swap space. Thank you in advance. (1 Reply)
Discussion started by: VeroL
1 Replies
Login or Register to Ask a Question