While working at Savoir-faire Linux (SFL) in Montreal, I was commissioned to perform some Linux experimentation on an old SBC, using Buildroot, the PREEMPT-RT kernel build option, and FTrace. The first two articles have been posted on SFL’s web site – part 1 and part 2.
Although the work dried up and they let me go, I still believe in the folks at SFL and their work.
I need to encrypt the contents of my Drobo – at least the Drobo partitions that are going to contain my personal data. The Drobo is too old to natively support encryption.
To do LUKS, you need cryptsetup package. Use apt-get or apt command.
Configure LUKS partition
WARNING! The following command will remove all data on the partition that you are encrypting. You WILL lose all your information! So make sure you backup your data to an external source such as NAS or hard disk before typing any one of the following command.
In this example, I’m going to encrpt /dev/sdj1. Type the following command: # cryptsetup -y -v luksFormat /dev/sdj1
Sample outputs:
WARNING!
========
This will overwrite data on /dev/sdj1 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
This command initializes the volume, and sets an initial key or passphrase. Please note that the passphrase is not recoverable so do not forget it.
Switching to UUID Instead of Block Device Name
At this point, you can switch to using UUID reference, so the mapping won’t change if, say, your block devices show up in a different sequence. To find the UUID for a given partition, do the following:
Now, wherever you would see “/dev/sdj1”, you put UUID=<the UUID number copied from above>.
Open the Crypto Block Device
Type the following command create a mapping: # cryptsetup luksOpen /dev/sdj1 crypt_drobo2-5
Or, using UUID: # cryptsetup luksOpen UUID=85af2419-bde3-49e7-939a-2f231532a8b2 crypt_drobo2-5
Sample outputs:
Enter passphrase for /dev/sdj1:
You can see a mapping name /dev/mapper/crypt_drobo2-5 after successful verification of the supplied key material which was created with luksFormat command extension: # ls -l /dev/mapper/crypt_drobo2-5
First, you need to write zeros to /dev/mapper/crypt_drobo2-5 encrypted device. This will allocate block data with zeros. This ensures that outside world will see this as random data i.e. it protect against disclosure of usage patterns: # dd if=/dev/zero of=/dev/mapper/crypt_drobo2-5
The dd command may take many hours to complete. I suggest that you use pv command to monitor the progress: # pv -tpreb /dev/zero | dd of=/dev/mapper/crypt_drobo2-5 bs=128M
Sample outputs:
dd: error writing '/dev/mapper/crypt_drobo2-5': No space left on device ]
200GiB 0:16:47 [ 203MiB/s] [ <=> ]
1600+1 records in
1599+1 records out
214746267648 bytes (215 GB, 200 GiB) copied, 1008.19 s, 213 MB/s
To mount the new filesystem at /backup2, enter: # mkdir /mnt/drobo2-5
# mount /dev/mapper/crypt_drobo2-5 /mnt/drobo2-5
# df -H
# cd /mnt/drobo2-5
# ls -l
Closing the Paritition
Type the following commands: # umount /mnt/drobo2-5
# cryptsetup luksClose backup2
Re-Opening the Paritition
Type the following command: # cryptsetup luksOpen /dev/sdj1 backup2
# mount /dev/mapper/crypt_drobo2-5 /mnt/drobo2-5
# df -H
# mount
Sample outputs:
Type the following command ### see key slots, max -8 i.e. max 8 passwords can be setup for each device ####
# cryptsetup luksDump /dev/sdj1
# cryptsetup luksAddKey /dev/sdj1
Enter any passphrase:
Enter new passphrase for key slot:
Verify passphrase:
Remove or delete the old password: # cryptsetup luksRemoveKey /dev/sdj1
Please note that you need to enter the old password / passphrase.
Using the Encrypted Partition
This article outlines how to run fsck on an encrypted partition.
Yeah, in the machinations around my phones and breaking them, I wanted to put a few files onto the microSD card from the phone. I put it into an adapter, put the adapter into my computer, and… filesystem exFAT not recognized?!? Hmm.
I guess when I loaded up Ubuntu 18.04 onto this computer, I didn’t put the exFAT utilities onto it.
It turns out that it’s as simple as: sudo su -
apt-get update
apt-get install exfat-utils
Of course, you need to enter the root password when you “sudo su”.
It has been a minor annoyance for as long as I can remember. When using LINUX, or more specifically X-Windows on LINUX, clicking the mouse centre button would perform a paste wherever the cursor is right now. When you are using the scroll-wheel to scroll through a document, often the centre button has a hair-trigger and will perform a click (and therefore a paste) without even realizing it – and, boom! You have random (well, arbitrary) text in the middle of your document. Fortunately, if it’s source code, the compile or execution will almost always fail… so you can fix it. But, when it’s a word processing document… ugh! Continue reading “Centre Button BullSomething on LINUX”