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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

cryptsetup Command Examples in Linux

by Deepika

The cryptsetup command is a utility in Linux that is used to create and manage encrypted block devices. It allows you to set up encrypted disks, partitions, and other types of block devices, and provides tools for managing and accessing these devices.

To use the cryptsetup command, you will need to specify the name of the block device that you want to create or manage, as well as various options and arguments that control the behavior of the command.

For example, to create an encrypted block device:

# cryptsetup luksFormat DEVICE

This will create a new encrypted block device on the specified DEVICE. You will be prompted to enter a password, which will be used to encrypt and decrypt the device.

cryptsetup Command Examples

1. Initialize a LUKS volume (overwrites all data on the partition):

# cryptsetup luksFormat /dev/sda1

2. Open a LUKS volume and create a decrypted mapping at `/dev/mapper/{{target}}`:

# cryptsetup luksOpen /dev/sda1 target

3. Remove an existing mapping:

# cryptsetup luksClose target

4. Change the LUKS volume’s passphrase:

# cryptsetup luksChangeKey /dev/sda1

Filed Under: Linux

Some more articles you might also be interested in …

  1. flatpak: command not found
  2. compsize: command not found
  3. How to check rpm package integrity in Linux
  4. bzip2: A block-sorting file compressor
  5. dnf: command not found
  6. “git extras” Command Examples
  7. alacritty – Cross-platform, GPU-accelerated terminal emulator (Command Examples)
  8. w Command Examples in Linux
  9. “docker service” Command Examples
  10. How to enable text colour in vi similar to vim in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright