I have problem with understanding of disk partitions for swap. Problem is about size. I create new particion via fstab with size 2GB:
Command (m for help): n
Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-536870911, default 2048):
Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-536870911, default 536870911): +2G Partition 1 of type Linux and of size 2 GiB is set
After assight it for swap
mkswap /dev/sdc1
swapon /dev/sdc1
In /etc/fstab where this uuid is for /dev/sdc1
UUID=1ec60ea1-1ebe-420e-9bbc-bc75f25b4cb2 none swap sw 0 0
After check swap size
>> free | gr
ep -i swap | awk '{print $2" / 1024 " }' | bc -l
2047.99609375000000000000
>> free -g
total used free shared buff/cache available
Mem: 15 0 15 0 0 15
Swap: 1 0 1
>> free -h
total used free shared buff/cache available
Mem: 15G 221M 15G 8.4M 299M 15G
Swap: 2.0G 0B 2.0G
Question is why kb outputs are not fit into 2GB and where i lost missing this memory (if i am calculating correctly i miss 4kb, is it reserved for folders hierary?) Or where i did mistake ?
Environment:
>> fdisk -v
fdisk from util-linux 2.23.2
>> free -V
free from procps-ng 3.3.10
>> cat /proc/swaps | awk '{print $3" / 1024 " }' | bc -l
2047.99609375000000000000
>> cat /etc/*-release
CentOS Linux release 7.3.1611 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.3.1611 (Core)
I expect same size in KB and GB same as size of created partition