[Linux] mkswap: error: swap area needs to be at least 40 KiB

$ sudo mkswap /swapfile
mkswap: error: swap area needs to be at least 40 KiB

(1) 까닭

  크기가 40KiB(40 × 1024byte)보다 작은 파일은 mkswap으로 스왑 파일로 만들 수 없다. 여기에서는 /swapfile의 크기가 40Kib보다 작다는 뜻이다.

(2) 풀기

  크기가 적어도 40Kib인 파일로 스왑 파일을 만든다. 1GiB(1024×1024×1024Byte) 스왑 파일을 아래처럼 만들 수 있다.

$ sudo dd if=/dev/zero of=/swapfile bs=1M count=1024

$ sudo chmod 600 /swapfile

$ sudo mkswap /swapfile Setting up swapspace version 1, size = 1048572 KiB no label, UUID=d09c4955-c28d-4a01-9987-7dfe9d00f490

$ ll /swapfile -rw-------. 1 root root 1073741824 Aug 11 17:24 /swapfile

※ mkswap 도움말

Usage:
 mkswap [options] device [size]
Options:
 -c, --check               check bad blocks before creating the swap area
 -f, --force               allow swap size area be larger than device
 -p, --pagesize SIZE       specify page size in bytes
 -L, --label LABEL         specify label
 -v, --swapversion NUM     specify swap-space version number
 -U, --uuid UUID           specify the uuid to use
 -V, --version             output version information and exit
 -h, --help                display this help and exit
2022/08/20 15:45 2022/08/20 15:45
보람말 : , , , ,
글 걸기 주소 : 이 글에는 글을 걸 수 없습니다.

덧글을 달아 주세요