• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mkswap: command not found

by admin

The mkswap command is used to create swap space on a storage partition. It is typically used when you wish to move swap space to a different partition than the one that was created during system installation. For example, you might want to save space on a low-capacity boot drive.

It provides options to perform various tasks.

Option Used To
-c Verify that the device is free from bad sectors before mounting the swap space.
-p Set the page size to be used by the mkswap command. A page is a chunk of memory that is copied to the storage device during the swap process.
-L {label} Activate the swap space using labels applied to partitions or file systems.

If you encounter the below error while running the mkswap command:

mkswap: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install util-linux
Ubuntu apt-get install util-linux
Alpine apk add util-linux
Arch Linux pacman -S util-linux-ng
Kali Linux apt-get install util-linux
CentOS yum install util-linux-ng
Fedora dnf install util-linux-ng
Raspbian apt-get install util-linux

mkswap Command Examples

1. To make the swap:

# mkswap /dev/sdf 

2. To check the device (if it is a block device) for bad blocks:

# mkswap -c /dev/sdf 

3. To Force – go ahead even if the command is stupid:

# mkswap -f /def/sdf 

4. To Specify the page size to use:

# mkswap -p PAGESIZE 

5. To specify a label, to allow swapon by label:

# mkswap -L LABEL 

6. To specify the swap space version:

# mkswap -v0
# mkswap -v1 

7. To specify the UUID to use:

# mkswap -U UUID 

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to make alias command work in bash script or bashrc file
  2. How Files/Directories in /tmp gets Removed Automatically in CentOS/RHEL 5,6
  3. host: command not found
  4. apt-file: command not found
  5. CentOS / RHEL : How to configure a user account to never expire (disable password ageing)
  6. manpath Command Examples in Linux
  7. CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  8. XFS error: Unable to mount filesystem With Noacl Permission in CentOS/RHEL 7
  9. fcrackzip: command not found
  10. Linux: No space left on device while df command shows a lot of free space

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright