[clue] [tech] force Linux kernel to release swap device

Jim Ockers ockers at ockers.net
Thu Jul 28 11:20:31 MDT 2011


Hi CLUEbies,

In a test of my sysadmin mojo I changed out all of the SATA hard drives 
in a server without downing the server or any of the VMs it was 
running.  I used Linux software RAID1 to move the data around to 
whatever drives were swapped in and that all worked perfectly fine.

One thing I forgot to do, though, was release the swap space on /dev/sdb 
before pulling the drive.  The OS was not using any swap space before I 
pulled the drive, and it is still not using much/any swap space now.  
However, the /dev/sdb device is not freed and can't be re-used, and 
swapoff -a doesn't work, and now I see these sorts of messages in the 
system log:

scsi 1:0:0:0: rejecting I/O to dead device
Write-error on swap-device (8:16:1000)
scsi 1:0:0:0: rejecting I/O to dead device
Write-error on swap-device (8:16:392)
Write-error on swap-device (8:16:400)
Write-error on swap-device (8:16:408)
scsi 1:0:0:0: rejecting I/O to dead device
Write-error on swap-device (8:16:520)

I guess /dev/sdb is 8,16.

There is swap space available on /dev/sda now (I remembered to release 
that swap space before pulling the drive and replacing it), but it's 
just that there seems to be now way to get the kernel to release its 
swap usage on /dev/sdb, which doesn't exist any more as a device in the 
system.

swapoff -a doesn't do it, nor does any other arguments to swapoff (like 
swapoff /dev/sdb2).
eject /dev/sdb doesn't do it.
echo "- - -" > /sys/class/scsi_host/host1/scan to force a SATA rescan 
also doesn't do it.
The drive I put in the 2nd slot showed up as sde, so now I have in 
order: sda, sde, sdc, sdd.

Any ideas for how I can force the kernel to release its swap space on 
the nonexistent drive, without a reboot of the host OS (which will also 
occasion a reboot of all the VMs?  Yes I know I should have done it 
BEFORE pulling the drive but I forgot, OK?

Thanks,
Jim

-- 
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: http://www.ockers.net/msi.html


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20110728/08b56df6/attachment.html 


More information about the clue mailing list