Search code examples
amazon-ec2swap

Swapon --show does not update gb size when resizing disk


I was wondering about something, I used AWS to resize a swap partition on an EC2 instance. When I ssh into the instance and use the command swapon --show in the console I still get the old GB value of the partition, however, if I use lsblk for example, the correct GB value is shown. Is that a bug? Which one of these can I trust now? I want to be certain that the swap space is also properly assigned and used.

enter image description here


Solution

  • You have to swapoff first and use mkswap and then swapon.

    1. sudo swapoff /dev/nvmelnl
    2. sudo mkswap /dev/nvmelnl
    3. sudo swapon /dev/nvmelnl
    4. sudo swpaon --show