swapoff?

Technical issues/questions of an intermediate or advanced nature.
User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

swapoff?

Post#1 by Rava » 29 Aug 2023, 14:58

I removed an external harddrive after umounting all mounted devices, forgting that it was auto-swapon'd as well at boot time.
Now it seems I cannot swapoff that device:

Code: Select all

root@porteus:/# type sx
sx is a function
sx () 
{ 
    echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________;
    { 
        read firstLine;
        echo "$firstLine";
        while read f t s u p; do
            let "s2 = $s / 1024";
            let "u2 = $u / 1024";
            printf '%-40s%-16s%-8s%-8s%-8s\n' $f $t $s2 $u2 $p;
        done
    } < /proc/swaps
}

Code: Select all

root@porteus:/Lsfind# sx
29.08.2023 16:55:59 ____________________________________________________________
Filename				Type		Size	Used	Priority
/dev/sdb1040(deleted)                   partition       4095    15      1       
/dev/sda6                               partition       4607    16      1       
/dev/zram0                              partition       309     309     100     

Code: Select all

root@porteus:/# swapoff /dev/sdb1
swapoff: /dev/sdb1: swapoff failed: No such file or directory
root@porteus:/# swapoff /dev/sdb1040
swapoff: /dev/sdb1040: swapoff failed: No such file or directory
root@porteus:/# ls /dev/sdb*
/bin/ls: cannot access '/dev/sdb*': No such file or directory
Is there a way to remove the unavailable swap device from the system?

I presume, if there is not, sdb will not be available for any new plugged into device unless I reboot.
Cheers!
Yours Rava