Command to check swap partition size under Linux

Commands to check the size of swap partition under Linux
  top
  or fdisk -l
  or free -m
  SWAP partition is generally twice the size of physical memory, but the maximum size does not exceed 2G;
  there are two ways to increase SWAP space: adding another SWAP partition, or Do this by creating a SWAP file.
  1) Add a SWAP partition:
  1) Create a SWAP partition: fdisk -l /dev/cciss/c0d0 (m---p ---n --t (convert the partition format to 82)--w) (such as /dev/cciss/c0d0p6)
  2) Format the partition: mkswap -c v1 /dev/cciss/c0d06;
  3) Modify the /etc/fstab file and add
  /dev/cciss/c0d0p6 swap swap default 0 0
  4) Activate the swap partition : swapon -a /dev/cciss/c0d0p6;
  5) View swap partition: swapon -s or free or cat /proc/swaps
  2) Add a SWAP file;
  1) dd if=/dev/zero of=/tmp/tmp .swap bs=1M count =100; (create a 100M file);
  2) mkswap /tmp/tmp.swap; (identified as a SWAP file)
  3) swapon /tmp/tmp.swap; (activate the SWAP file)
  4) Modify the /etc/fstab file and add the following:
  /tmp/tmp.swap swap swap default 0 0
  5) Check with swapon -s or free or cat /proc/swaps.
  3) Delete the SWAP partition:
  1) swapoff /dev/cciss/c0d0p6;
  2) Modify the /etc/fstab file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326450538&siteId=291194637