Advertisement

Friday, May 25, 2018

Oracle Database - 12c/18c - Swap : swapon: /swapfile: swapon failed: Invalid argument

As per the recent changes made in xfs system the normal procedure of fallocate does not works when you are creating a swap file 
You will get error : Invalid arguement which is quite misleading. 


The key reason is xfs does not supports allocations for swap file using fallocate.

For this  you need to use dd instead of fallocate and below is the procedure. 

1. Create Empty File 
I am creating a 16G swap, here count - 16384 and bs is 1MB
dd if=/dev/zero of=16G.swap count=16384 bs=1MiB

2. Change permissions
chmod 0600 16G.swap

3. Create Swap
mkswap 16G.swap

4. Add entry to /etc/fstab
/swp/16G.swap none  swap  sw 0  0

5. Enable Swap
swapon -a

This will create swap on xfs file system.

No comments:
Write comments