Let's suppose I create a file, map it to /dev/loop0, and create a LUKS partition inside

dd if=/dev/zero of=myfile bs=1M count=1000
losetup /dev/loop0 myfile 
cryptsetup -c aes-cbc-essiv:sha256 -s 256 -v -y luksFormat /dev/loop0

I then open the encrypted partition

cryptsetup luksOpen /dev/loop0 myfile

Now, I have my encrypted file appear as a disk /dev/mapper/myfile. I need to create a filesystem before I can use it.

Here is my question: Given that this my new filesystem-inside-file resides on another ext4 filesystem (which already is using journal), what options would be best for this new filesystem ?

Specifically, if I format my new filesystem-inside-file ext4, should I use journal?. Somehow, the idea of journal filesystem inside another journal filesystem seems not right to me, intuitively.

  • That's a bizarre setup. Why not use ecryptfs? – Gilles Jan 18 '14 at 23:38
  • 1
    what are the advantages of eCryptfs over my solution? I don't know eCryptfs, so I cannot compare it. But the setup I am using is simple and transparent. – Martin Vegter Jan 19 '14 at 13:17

From my experience running an encrypted reiserfs with private information you should not put that on an journalling filesystem like ext3. I switched back from ext3 to having the file on an ext2 partition after I had to restore from a backup.

Over the years ( I have had this file for 5 years ), I had to run recovery several times, and when hosted on ext3 this was the only time reiserfsck could not recover. I think that was because ext3 did a recover which confused the internals of the encrypted disk.

I never tried a non-journal filesystem on a journal filesystem (e.g. encrypted ext2 file on reiserfs) for me the important (i.e. encrypted data should be journalled).

I am still running reiserfs, never used ext4 for this (but I am considering btrfs, just need to check some time if that is stable enough)

If you put your homedirectory on there, be prepared that this feels a bit sluggish, I don't think any finetuning with parameters could have helped that, and I don't think the ext4 ones will influence things much, given that encryption is a performance penalty hit in all directions.

  • that is very interesting. Could you perhaps explain why you prefer reiserfs/btrfs above ext4 ? – Martin Vegter Jan 18 '14 at 10:18
  • @MartinVegter ReiserFS was the only option when I wanted a journaling filesystem, ext3 came years later. Btrfs seems the next major step. – Timo Jan 18 '14 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.