Encrypt a disk in Ubuntu Linux using Cryptsetup

LUKS Linux Unified Key Setup

Cryptsetup is a utility used to setup disk encryption and is based on the DMCrypt kernel module. It implements LUKS which is the standard for Linux hard disk encryption.

LUKS provides a standard on-disk-format and facilitates compatibility among distributions while also providing secure management of multiple user passwords. In contrast to existing solutions, LUKS stores all setup necessary setup information in the partition header, enabling the user to easily transport the data.

Today we will examine how to setup encryption on a 32GB SanDisk USB thumb-drive using Ubuntu Linux.

Continue reading

Using dd to erase GUID Partition Tables (GPT)

Two disks that I had previously used on an mdadm mirrored raid were complaining about preexisting partition information and apparently thought they still belonged to a raid even though I had already zeroed out the superblocks.  These disks had also been formated with GPT. Mdadm alerted me to the remnants when trying to setup a new raid.

GPT stores its protective MBR, primary GPT header and primary GPT table within the first couple of logical sectors on a disk. Additionally a backup secondary GPT table and secondary GPT header are stored on the last few logical sectors .

Continue reading

Configure a RAID array using mdadm

Redundant Array of Independent Disks

Today we will  demonstrate how to create a mirrored raid using two identical 120GB hard drives. A quick lsblk will help us identify the devices that we will be working with.

sda       8:0       0    100G     0    disk
├─sda1    8:1       0     96G     0    part        /
├─sda2    8:2       0      1K     0    part
└─sda5    8:5       0      4G     0    part      [SWAP]
sdb       8:16      0    120G     0    disk
sdc       8:32      0    120G     0    disk
sr0       11:0      1   1024M     0     rom

As a best practice raw disks should be partitioned before creating an array. Additionally the partitions should be sized smaller than the max total size of the physical disk (a few megabytes will suffice). If the need arises to replace one of the disks in the future then this can prove to be useful since they may not be the exact same size and raid likes to deal with identical sizes.

Continue reading

Creating a RAMdisk

RAMdisks are virtual partitions that reside in memory except all data is lost when power is removed from the system. Reads and writes are lighting fast in comparison to standard mechanical and NAND based storage. There can be real performance benefits when used correctly.

Today we will review how to create one on using a Debian-based distribution.

Continue reading

Dump a large disk image onto a smaller disk

Replacing your mechanical hard drive with an SSD is an upgrade that you will actually notice. All of a sudden everything seems faster. From booting and loading applications to the overall responsiveness of your operating system.

To put things into perspective I benchmarked a couple of drives that I currently have installed.

Test details: 10mb file sampled for each test 100times, 10mb file sampled 1000 times for access times

Continue reading