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

Jim Ockers ockers at ockers.net
Thu Jul 28 11:57:39 MDT 2011


Hi Shawn,

As soon as I realized the error of my ways, I tried reconnecting the 
original /dev/sdb to the exact same SATA port, but then it was 
recognized as /dev/sdf.  It seems that the /dev/sdb device name is 
allocated by the kernel, and can't be freed, and can't be re-used or 
re-allocated to any new device.  Even putting the exact same drive back 
in the exact same slot doesn't work, because the drive is allocated an 
"available" name, and sdb is not "available" it seems.

There is not currently any sdb but the kernel still apparently holds on 
to /dev/sdb2 (cf the log messages with write errors to 8:16) until I can 
somehow force it to release that swap space, which is what I can't seem 
to get it to do.

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


Shawn Perry wrote:
> If you have a USB to SATA adapter, reconnect the old /dev/sdb and then 
> try swapoff.
>
> Did you try swapoff /dev/sdb ?
>
> Is there currently another /dev/sdb?
>
>
> Shawn T Perry
> Red Mop Computing Services
> email: shawn at redmop.com <mailto:shawn at redmop.com>
> office: 720-319-7627
> cell: 303-881-2623
> web: http://www.redmop.com <http://www.redmop.com/>
> facebook: 
> http://www.facebook.com/pages/Red-Mop-Computing-Services/114352628589778
> linkedin: http://www.linkedin.com/in/shawnperry
>
>
> On Thu, Jul 28, 2011 at 11:20 AM, Jim Ockers <ockers at ockers.net 
> <mailto:ockers at ockers.net>> wrote:
>
>     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 <mailto:ockers at ockers.net>)
>     Contact info: http://www.ockers.net/msi.html
>
>         
>
>
>     _______________________________________________
>     clue mailing list: clue at cluedenver.org <mailto:clue at cluedenver.org>
>     For information, account preferences, or to unsubscribe see:
>     http://cluedenver.org/mailman/listinfo/clue
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue

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


More information about the clue mailing list