Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 04-13-2007, 07:15 AM   #1
Registered: Dec 2006
Posts: 36

Rep: Reputation: Disabled
Space in Bytes on a partition

i want to encrypt a whole partition with truecrypt, and i dont want to waste space. Is there a way to find out what the EXACT Space (so in bytes) on a partition is?

Thank you.

der Maxist
Old 04-13-2007, 07:29 AM   #2
Registered: Feb 2007
Location: Israel
Distribution: openSuSE
Posts: 59

Rep: Reputation: 15
Just type "df"
Old 04-13-2007, 12:17 PM   #3
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
You don't need to know the size of a partition to encrypt it with True Crypt. You only need to specify a size if you are creating a hidden volume. First let me say that I am using True Crypt v4.2a so if there are changes with the new version I am unaware of them. Here is what you do.

Encrypt the partition using truecrypt -c.

Map the partition using truecrypt.

Make a file system on the virtual device using mkfs.

Mount the virtual device.

Then when you need to remount the device you just map the partition to a True Crypt virtual device and mount the virtual device. You can do this in one step once the partition has a file system.

This is how to do it for /dev/hda1. First encrypt the partition using truecrypt.
truecrypt -c /dev/hda1
Volume type:
 1) Normal
 2) Hidden
Select [1]: 1

 1) FAT
 2) None
Select [1]: 2

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

Enter password for new volume '/dev/hda1':
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]:

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

Done: 8578.22 MB  Speed: 15.12 MB/s  Left: 0:00:00
Volume created.
Then map the partition to a virtual True Crypt device.
truecrypt /dev/hda1
Enter password for '/dev/hda1':
Create a file system on the virtual device. Note that you can use truecrypt -l to list True Crypt virtual devices.
truecrypt -l
/dev/mapper/truecrypt1 /dev/hda1
/dev/mapper/truecrypt0 /dev/hda7

mkfs -t ext3 /dev/mapper/truecrypt1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1098880 inodes, 2196880 blocks
109844 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2252341248
68 block groups
32768 blocks per group, 32768 fragments per group
16160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

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

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Now you can mount the virtual device using the mount command.
mount /dev/mapper/truecrypt1 /mnt/hda1
You don't have to worry about dismounting the True Crypt volume when the system shuts down. If you want to dismount and unmap a True Crypt virtual device you can do this.
umount /mnt/hda1
truecrypt -d /dev/mapper/truecrypt1
Now, since the partition has been set up you can mount it any time with one command.
truecrypt /dev/hda1 /mnt/hda1
Enter password for '/dev/hda1':
You can even tell True Crypt about mount options for the partition using the -M parameter of the truecrypt utility.
truecrypt -M noexec,sync /dev/hda1 /mnt/hda1
Enter password for '/dev/hda1':
I don't know if you wanted that much information but your question suggested that you didn't understand how to use True Crypt.

Last edited by stress_junkie; 04-13-2007 at 12:23 PM.
Old 04-14-2007, 12:58 PM   #4
Registered: Dec 2006
Posts: 36

Original Poster
Rep: Reputation: Disabled
Thanks alot! This is, what i needed.

der Maxist

PS.: There is a very good tutorial in german (personally, I have got no idea about truecrypt, but this goes a bit more in detail, so I dont need to find out myself :-D)



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't partition free space from shrunken partition john_b Linux - Newbie 7 01-14-2006 05:43 AM
I want to increase my Linux partition.Should I take space from a Windows partition? PrinceBalak Linux - General 1 06-25-2004 06:44 PM
Cant get fdisk or cfdisk to partition my 20gig Bytes disk Heath Linux - Newbie 3 05-19-2004 06:08 AM
Partition Free Space - Move /home to the new partition gregkise Linux - General 5 12-16-2003 11:19 PM
ext3. size:26gb,space used-24gb...0 bytes left?? jago25_98 Linux - Software 4 12-09-2003 02:43 PM

All times are GMT -5. The time now is 10:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration