I'm going to set up a new laptop system soonish (more on that later) which shall have a completely encrypted hard drive. Hence, I'm testing a few setups wrt security, performance, manageability and fault-tolerance.
Here's a few performance tests I did on an 80 GB laptop hard drive (in an Intel Celeron based laptop, 1.7 GHz, 256 MB RAM, Linux 2.6.17, Debian unstable).
I ran bonnie++ (with no options) and hdparm as hdparm -tT /dev/hda each time. I haven't put too much thought into the test setup, so if I made some stupid mistakes, please let me know.
Unencrypted plain ext3 partitions:
bonnie++:
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
forest 432M 19857 84 21831 10 9536 4 16355 58 22165 3 148.8 0
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 1650 98 +++++ +++ +++++ +++ 1734 98 +++++ +++ 3820 96
forest,432M,19857,84,21831,10,9536,4,16355,58,22165,3,148.8,0,16,1650,98,+++++,
+++,+++++,+++,1734,98,+++++,+++,3820,96
bonnie++ with SELinux:
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
forest 432M 20321 90 21036 13 9473 5 16742 61 21978 4 148.1 0
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 1398 98 +++++ +++ +++++ +++ 1473 98 +++++ +++ 3305 98
forest,432M,20321,90,21036,13,9473,5,16742,61,21978,4,148.1,0,16,1398,98,+++++,
+++,+++++,+++,1473,98,+++++,+++,3305,98
hdparm:
Timing cached reads: 1416 MB in 2.00 seconds = 707.48 MB/sec Timing buffered disk reads: 82 MB in 3.06 seconds = 26.80 MB/sec
hdparm with SELinux:
Timing cached reads: 1404 MB in 2.00 seconds = 700.59 MB/sec Timing buffered disk reads: 80 MB in 3.02 seconds = 26.53 MB/sec
Ext3 partitions on top of LVM on top of dm-crypt:
bonnie++:
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
forest 464M 11149 54 16660 20 6461 5 7472 58 11129 5 136.4 0
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 1564 98 +++++ +++ +++++ +++ 1650 98 +++++ +++ 2640 97
forest,464M,11149,54,16660,20,6461,5,7472,58,11129,5,136.4,0,16,1564,98,+++++,
+++,+++++,+++,1650,98,+++++,+++,2640,97
bonnie++ with SELinux:
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
forest 464M 9878 52 12138 11 5457 6 6834 56 11037 5 137.2 0
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 1426 97 +++++ +++ +++++ +++ 1451 98 +++++ +++ 2433 97
forest,464M,9878,52,12138,11,5457,6,6834,56,11037,5,137.2,0,16,1426,97,+++++,
+++,+++++,+++,1451,98,+++++,+++,2433,97
hdparm:
Timing cached reads: 1408 MB in 2.00 seconds = 704.01 MB/sec Timing buffered disk reads: 80 MB in 3.02 seconds = 26.53 MB/sec
hdparm with SELinux:
Timing cached reads: 1396 MB in 2.00 seconds = 698.06 MB/sec Timing buffered disk reads: 82 MB in 3.07 seconds = 26.69 MB/sec
So yes, there is some overhead, but it's nothing too serious, IMHO. And quite honestly, I don't care too much about performance here — security is more important than performance. I think you'll agree; if you don't agree now, you will agree with me on the very day someone steals your laptop ;-)
A few weeks ago I published a small HOWTO for using loop-aes to encrypt your hard drive, usb thumb drive etc.
As I have bought a new 300 GB external USB disk drive on Friday, I have tried something new this time: disk encryption using dm-crypt / LUKS. It has been suggested to me multiple times that dm-crypt is superior to loop-aes, however I didn't get a real reason. Yes, it doesn't require any kernel patches and is easier to setup. But has any serious cryptographer looked at it sharply, yet? Did it withhold his eye contact?
Anyways, here's how I encrypted my 300 GB drive. I largely followed the guide at the EncryptedDeviceUsingLUKS wiki page...
badblocks -c 10240 -s -w -t random -v /dev/sdb/dev/sdb with whatever is correct on your system. If you're really paranoid, and are willing to wait one or two days, do this:dd if=/dev/urandom of=/dev/sdb
apt-get install cryptsetupcfdisk /dev/sdb/dev/sdb1.
cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb1/dev/mapper/samsung300gb device:cryptsetup luksOpen /dev/sdb1 samsung300gb
mkfs.ext3 -j -m 1 -O dir_index,filetype,sparse_super /dev/mapper/samsung300gbmkdir /mnt/samsung300gbmount /dev/mapper/samsung300gb /mnt/samsung300gb/mnt/samsung300gb will be encrypted transparently.
umount /mnt/samsung300gbcryptsetup luksClose /dev/mapper/samsung300gb
After unmounting, nobody will be able to see your data without knowing the correct passphrase. Drive is stolen? No problem. Drive is broken, and you want to send it in for repair without the guys there poking in your data? No problem. You leave the USB drive at home and some jerk breaks into your house, steals your drive, rapes your wife, and kills your kids? No problem. Well, sort of, but you get the idea ;-)
There's more things you can do, thanks to LUKS: have multiple passphrases which unlock your data, change/add/remove passphrases as you see fit, etc.
Comments?
Update 2006-04-17: You have to use cryptsetup from unstable if you want LUKS support. cryptsetup in testing does not support this (thanks Ariel).
Recent comments
25 weeks 1 day ago
51 weeks 3 days ago
1 year 6 weeks ago
1 year 7 weeks ago
1 year 7 weeks ago