I have a Unix based question.


Trying to create local image which is coded by the cryptsetup tool. Here are my steps:

abcdef# dd if=/dev/zero of=image.img bs=512M count=1
1+0 records in
1+0 records out
536870912 bytes (537 MB) copied, 6.39732 s, 83.9 MB/s
abcdef# cryptsetup luksFormat image.img

This will overwrite data on image.img irrevocably.

Are you sure? (Type uppercase yes): YES
Cannot read device image.img.

How can I make it work correctly(creating local image with crypting support) or how can I (if its possible of course) to swindle my os? Any idea's ? :)


You should use loopback device for this:

losetup /dev/loop0 image.img
cryptsetup luksFormat /dev/loop0

Probable next steps:

cryptsetup luksOpen /dev/loop0 qqq
mkfs.ext3 /dev/mapper/qqq
mount /dev/mapper/qqq /mnt/tmp/

# work with mounted container in /mnt/tmp

umount /mnt/tmp/
cryptsetup luksClose qqq
losetup -d /dev/loop0
|improve this answer|||||

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.