Hey

I want to make a VHDD (V.irtual H.ard D.rive D.isc) using the dd command and then encrypt it. I was told I had to do something with loop also to encrypt it but cant find anything. I dont want to experiment as dd is VERY powerful and can fuck up my drive. Thanks :)

Well, the simplest way to make a blank image on your drive is to do something like this: dd if=/dev/zero of=filename.img bs=512 count=102400 That will create a 50 MB disk image with 102400 512-byte blocks (102400 blocks/2 blocks in a kB/1024 kB in a MB = 50 MB), and the image will be filled with zeros.

You can create an alternate version where the zeros are implied, but they aren't written to disk. Therefore, the disk image is sparse and will only use up the amount of space that data is actually occupying (as compared to the previous image, which will use 50 MB of disk space regardless of what's stored on it). dd of=filename.img bs=512 count=0 seek=102400 Finally, here's how you create a filesystem on it and store files. First, associate a loop device with your disk image. Usually /dev/loop0 is available for this (although if you've got some other disk images mounted, use the next available loop device). Note that you need root permissions for the following commands. losetup /dev/loop0 filename.img Now that you've got an associated loopback device, you can create your filesystem: mke2fs /dev/loop0 Finally, you can mount the filesystem: mount -t ext2 /dev/loop0 /mnt I'll leave the encryption up to you.

Well, the simplest way to make a blank image on your drive is to do something like this: dd if=/dev/zero of=filename.img bs=512 count=102400 That will create a 50 MB disk image with 102400 512-byte blocks (102400 blocks/2 blocks in a kB/1024 kB in a MB = 50 MB), and the image will be filled with zeros.

You can create an alternate version where the zeros are implied, but they aren't written to disk. Therefore, the disk image is sparse and will only use up the amount of space that data is actually occupying (as compared to the previous image, which will use 50 MB of disk space regardless of what's stored on it). dd of=filename.img bs=512 count=0 seek=102400 Finally, here's how you create a filesystem on it and store files. First, associate a loop device with your disk image. Usually /dev/loop0 is available for this (although if you've got some other disk images mounted, use the next available loop device). Note that you need root permissions for the following commands. losetup /dev/loop0 filename.img Now that you've got an associated loopback device, you can create your filesystem: mke2fs /dev/loop0 Finally, you can mount the filesystem: mount -t ext2 /dev/loop0 /mnt I'll leave the encryption up to you.

Thank you very much for the explanation :)

The problem is Ive already looked up encryption for more than a week and a half but havent found anything. And I thought that /dev/loop had something to do with encryption instead of mounting it (thats what I read)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.