# swapoff /dev/mapper/swap
swapoff: /dev/mapper/swap: swapoff failed: Cannot allocate memory
# dd if=/dev/zero of=/home/swap bs=1024 count=1024000
# swapon /home/swap
swapon: /home/swap: insecure permissions 0644, 0600 suggested.
swapon: /home/swap: read swap header failed: Invalid argument
# mkswap /home/swap
# swapon /home/swap
# free
total used free shared buff/cache available
Mem: 32782064 30765328 262560 1607488 1754176 219732
Swap: 1654776 401236 1253540
# swapon -s
Filename Type Size Used Priority
/dev/mapper/swap partition 630780 0 -2
/home/swap file 1023996 401236 -1
# swapoff /home/swap
# swapon -s
Filename Type Size Used Priority
/dev/mapper/swap partition 630780 431836 -1
# rm /home/swap
rm: remove regular file ‘/home/swap’? y
# free -h
total used free shared buff/cache available
Mem: 31G 29G 222M 1.6G 1.7G 190M
Swap: 615M 421M 194M
No comments:
Post a Comment