Operating System - HP-UX
1819791 Members
3331 Online
109607 Solutions
New Discussion юеВ

can I change the swap device without rebooting the server?

 
Hanry Zhou
Super Advisor

can I change the swap device without rebooting the server?

I already have the device /dev/vg01/xyz configured as swap deivce, now I need to replace the disk, so I create the new swap device /dev/vg01/abc, and did swapon on this new one, put it into /etc/fstab file as well.

As I understand I have to reboot the box to take the change effect, and I can't just lvremove the old device. Am I right?

none
6 REPLIES 6
Patrick Wallek
Honored Contributor

Re: can I change the swap device without rebooting the server?

The only way to deactivate a swap device is to reboot the server.

Another way for you to do this might have been to mirror /dev/vg01/xyz to another disk, then reduce the mirror off of the disk you are going to replace. That is assuming you have Mirror Disk installed.

Once /dev/vg01/xyz is reduced off of the disk you want to replace, you could take that disk out of the VG and then replace it.

As things stand right now though, I think a reboot is your only option.
Sundar_7
Honored Contributor

Re: can I change the swap device without rebooting the server?

Yes, you need to reboot the system to be able to remove the disk.

swap devices cannot be deactivated without rebooting the system.

Learn What to do ,How to do and more importantly When to do ?
Camel_1
Valued Contributor

Re: can I change the swap device without rebooting the server?

I think reboot is the solution!

Cesare Salvioni
Trusted Contributor

Re: can I change the swap device without rebooting the server?

No way to change the swap device, but if your goal is to change the disk you can use pvmove to move the PE allocated to a LV to another disk, freeing the first one.
Follow these steps:


pvcreate /dev/dsk/new_disk
vgextend vg01 /dev/dsk/new_disk

now find out where are allocated the PE of /dev/vg01/xyz
lvdisplay -v /dev/vg01/yxz | more

you should see the disks used by this LV
for each of them run:

pvmove -n /dev/vg01/xyz /dev/dsk/old_disk /dev/dsk/new_disk

this last command move all the PE from old_disk to new_disk transparently, even if LV is used

see http://www.docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B9106-90008/B9106-90008_top.html&con=/hpux/onlinedocs/B9106-90008/00/03/303-con.html&toc=/hpux/onlinedocs/B9106-90008/00/03/303-toc.html&searchterms=pvmove&queryid=20040813-173308

Hope it helps
Patrick Wallek
Honored Contributor

Re: can I change the swap device without rebooting the server?

Good idea with the pvmove suggestion, Cesare. That would also be an excellent way to do it!
Bill Hassell
Honored Contributor

Re: can I change the swap device without rebooting the server?

Active swap disks are the same as memory. If a swap disk (or RAM) is removed, the system will crash (panic). But Casare's suggestion will work very well. The reason is that pvmove is an atomic process, that is, each extent is copied completely, locking out any change to the extent during the copy. However, if your old disk has sector errors in the swap LV, pvmove will fail.


Bill Hassell, sysadmin