1752523 Members
4813 Online
108788 Solutions
New Discussion юеВ

Device swap

 
shruti_1
Advisor

Device swap

I want to add one hard disk to my servr. and want to use it as swap device. I need to procedure to do that could anyone help me on this.

3 REPLIES 3
MarkSyder
Honored Contributor

Re: Device swap

The whole disc? Seems a bit extravagant.

The easiest way is via SAM. Set up a new logical volume and set the use to swap rather than filesystem. But given that the smallest discs currently available are 36 Gb I would rethink - that is an awful lot of swap and potentially wasted disc space.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Patrick Wallek
Honored Contributor

Re: Device swap

You really should add 2 disks and mirror them. You REALLY need to have your swap space mirrored. If the disk you add goes bad, there is a chance that your system could have severe problems.
Ninad_1
Honored Contributor

Re: Device swap

Shruti,

As already advised by Patrick, you should look at adding 2 disks as swap should be mirrored so as to cater against failure of disk used by swap in which case there is high probability that the system will crash.
The steps would be

Add the disks to the VG (Need not be vg00 can be any existing vg or a new VG. Assuming adding to new VG)
1. Create a VG
mkdir /dev/vgnew
mknod /dev/vgnew/group c 64 0xnn0000
(nn should be unique no. - check using ll /dev/*/group)
pvcreate /dev/rdsk/c?t?d? (pvcreate both disks)
vgcreate /dev/vgnew /dev/dsk/c?t?d? /dev/dsk/c?t?d?
2. create volume for swap
lvcreate -L 1024 -n swapvol2 -C y -r n /dev/vgnew -s y -m 1
3. add following line to /etc/fstab
/dev/vgnew/swapvol2 swap swap defaults 0 0
4. swapon -a

Please let us know more details if your requirement is anything else.
Regards,
Ninad