Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » How to encrypt a partition with Cryptsetup
  • PXE Boot to Install OS HyperV
    Run Hype-V on Windows 11 and Install Windows OS via PXE Boot Windows
  • wds and dns l
    What happens when WDS and DNS are installed on the same Windows Server? DNS issues with WDS Windows Server
  • AWS Principals
    MFA on Root Account: Create a User on AWS and Register MFA AWS/Azure/OpenShift
  • Bulk operations in Azure AD
    Perform Bulk User Operations in Azure AD AWS/Azure/OpenShift
  • SUBVERSION FEATURE
    How to Install Apache Subversion on a Linux System Linux
  • image 129
    How to deploy Ansible AWX on centos 8 Linux
  • 1 WeXxkEX0JG3oB781HD8Hrg 1
    Command Prompt in Windows: Creating Volumes Guide Windows
  • Screenshot
    How to change the Windows Pagefile Size Windows Server

How to encrypt a partition with Cryptsetup

Posted on 16/09/202022/09/2023 Christian By Christian No Comments on How to encrypt a partition with Cryptsetup

Cryptsetup is a utility used to conveniently set up disk encryption based on the DMCrypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES, TrueCrypt (including VeraCrypt extension), and BitLocker formats. LUKS is the standard for Linux hard disk encryption. By providing a standard on-disk-format, it does not only facilitate compatibility among distributions but also provides secure management of multiple user passwords. LUKS stores all necessary setup information in the partition header, enabling to transport or migrate data seamlessly. Here are some interesting articles: How to add a new partition to an existing Linux server, ESXI 6.7 ALARM: Seat disk exhaustion on 10, and how to setup up WatchGuard Log and Report Server in a VM.

Cryptsetup utility aids in configuring encrypted filesystems. To begin, you must have the cryptsetup-luks package installed. You can use the fdisk –l or blkid command to get a list of available partitions.  For the purpose of this tutorial, I created a new partition called loop2. I will now encrypt our loop2 partition with Cryptsetup.
get the list of the available partitions

Before we encrypt a partition with Cryptsetup, ensure you have backed up essential data on that partition. Furthermore, encryption will overwrite any existing data on the partition.

cryptsetup --verbose --verify-passphrase luksFormat /dev/partition-name

To proceed, type YES in block letters. (Pay attention to the warning.) Afterward, you will need to input a password.

type in YES
cryptsetup luksOpen /dev/partition-name partition-name

This command will prompt you for the password you used for the encryption

Eneter your encryption passphrase

Once it is opened, the already encrypted partition is automatically mapped out to dev/mapper/partition-name and a quick delve into the fdisk –l command will confirm just that.

Encrypted partition has been mapped out

To start using this partition, you will need to format the partition with a filesystem of your choice and then mount it. I used the mkfs command in my own case

mkfs.ext4 /dev/mapper/partition-name
Format the partition filesystem and then mount it

Thats how to encrypt a partition with Cryptsetup. I hope you found this blog post helpful. So, if you have any questions, please let me know in the comment session.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:disk, encrytp

Post navigation

Previous Post: Error 0x80070002: When trying to mount an image file
Next Post: How to stop Microsoft Edge from remembering your email ID

Related Posts

  • SystemUtilization
    Delivering System Utilization Report on a Linux based OS Linux
  • sdfdghjk
    How to fix “Job for Mattermost service failed” error Linux
  • images copy
    How to disable automatic screen lock in Ubuntu Linux Linux
  • final tomcat feature
    How to install Apache Tomcat on Ubuntu Linux
  • Manage Log Files via Logrotate
    How To Use Logrotate For Managing Log Files In Ubuntu Linux Linux
  • 1 pUEZd8z  1p 7ICIO1NZFA
    The package python-virtualenv has no installation candidate error Linux

More Related Articles

SystemUtilization Delivering System Utilization Report on a Linux based OS Linux
sdfdghjk How to fix “Job for Mattermost service failed” error Linux
images copy How to disable automatic screen lock in Ubuntu Linux Linux
final tomcat feature How to install Apache Tomcat on Ubuntu Linux
Manage Log Files via Logrotate How To Use Logrotate For Managing Log Files In Ubuntu Linux Linux
1 pUEZd8z  1p 7ICIO1NZFA The package python-virtualenv has no installation candidate error Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • PXE Boot to Install OS HyperV
    Run Hype-V on Windows 11 and Install Windows OS via PXE Boot Windows
  • wds and dns l
    What happens when WDS and DNS are installed on the same Windows Server? DNS issues with WDS Windows Server
  • AWS Principals
    MFA on Root Account: Create a User on AWS and Register MFA AWS/Azure/OpenShift
  • Bulk operations in Azure AD
    Perform Bulk User Operations in Azure AD AWS/Azure/OpenShift
  • SUBVERSION FEATURE
    How to Install Apache Subversion on a Linux System Linux
  • image 129
    How to deploy Ansible AWX on centos 8 Linux
  • 1 WeXxkEX0JG3oB781HD8Hrg 1
    Command Prompt in Windows: Creating Volumes Guide Windows
  • Screenshot
    How to change the Windows Pagefile Size Windows Server

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,836 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.