hal1on
{ USER }
posts: 5
last: 13-Jul-2008
TITLE: Creating ext3 partitions with truecrypt
DESCRIPTION: Creating ext3 partitions with truecrypt version 4.2
Submitted: 19-Sep-2007 12:23:20 ( 1yrs 9w 0d 5h ago ) Language: APACHE (*.)
Views: 668 Lines of Code: 119 LINES
Rating:
rate: star1
star2
star3
star4
star5
dstar1
dstar2
dstar3
dstar4
dstar5  ( rated! )
  { 4.00 / 5 }
Difficulty: Intermediate
Bookmark
Introduction

What is EXT3 / truecrypt?

Truecrypt is a popular Encryption package available under Microsoft Windows and Linux, In this tutorial i shall be using Linux to setup a Truecrypt volume on a hard drive and format with Ext3 inside the Truecrypt volume.

Ext3 is probably the most used Filesystem under linux, However when attempting to encrypt a partition with Truecrypt it often only offers FAT Filesystem or NONE. this tutorial will show you how to create an Encrypted Ext3 partition using Truecrypt.

 

What are the Benefits

While it is easy to mount a FAT Filesystem under Linux, i prefer Ext2/Ext3 partitions under Linux, in my experience they are more stable than FAT, plus why not use a Filesystem under Linux which was specifically developed for the it.

Tutorial

Running TRUECRYPT

For this tutorial i will assume you already have Truecrypt installed, if you do no i suggest you visit www.truecrypt.org/ .

Creating a Truecrypt Volume

 

The first thing to do is create a volume with Truecrypt using:

 

server:~$ truecrypt -c

Volume type:
1) Normal
2) Hidden
Select [1]:

Select 1: for a standard volume type

 

 

Enter file or device path for new volume: /dev/hda3
Filesystem:
1) FAT
2) None
Select [1]: 2

 

Here we have selected our Device "/dev/hda3" which we intend to encrypt, Select 2) None for the Filesystem because we eventually want to format the encrypted space with Ext3 instead of FAT.

 

Enter volume size (bytes - size/sizeK/sizeM/sizeG): 1M

Hash algorithm:
1) RIPEMD-160
2) SHA-1
3) Whirlpool
Select [1]:1

Encryption algorithm:
1) AES
2) Blowfish
3) CAST5
4) Serpent
5) Triple DES
6) Twofish
7) AES-Twofish
8) AES-Twofish-Serpent
9) Serpent-AES
10) Serpent-Twofish-AES
11) Twofish-Serpent
Select [1]:1

Above we have now selected our Hash and Encryption algorithms, and the volume size (you may want more than what ive chosen in example!....alot more!).

 

 

Enter password for new volume '/dev/hda3':
Re-enter password:

Enter keyfile path [none]:

TrueCrypt will now collect random data.

Is your mouse connected directly to computer where TrueCrypt is running? [Y/n]:Y

Please move the mouse randomly until the required amount of data is captured...
Mouse data captured: 100%

Done: 0.00 MB  Speed: 0.00 MB/s  Left: 0:11:31
Volume created.
server:~$

And finally we enter a volume password, and Truecrypt asks for some random data for generating keys etc.

 

 

formatting the new truecrypt volume

Now that the Device has been Encrypted with a Truecrypt volume, we now need to mount it and format the space inside as an Ext3 Partition so that it has a useable filesystem:

truecrypt -N 0 /dev/hda3 && mke2fs -j /dev/mapper/truecrypt0

The above command will ask you for your Truecrypt password to mount the encrypted volume, and then format the partition for you.

 

Example:


server:~# truecrypt -N 0 /dev/hda3 && mke2fs -j /dev/mapper/truecrypt0
Enter password for '/dev/hda3':
mke2fs 1.37 (21-Mar-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
15695872 inodes, 31372936 blocks
1568646 blocks (5.00%) reserved for the super user
First data block=0
958 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

Finally once you have finished partitioning, you can mount your Ext3 formatted Truecrypt volume with:

 

truecrypt /dev/hda3 /mnt/my_folder_i_want_to_mount_to

And enter your password. You can then use your mounted folder like a normal folder, if the system reboots you will need to re-mount the folder.

 

 

you can also choose to dismount the volume manually at any time using:

 

truecrypt -d

omit any device names to dismount all devices/volumes.