Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a crypted drive on my loop0 device. For this command

/sbin/cryptsetup create cryptedDrive /dev/loop0

I'm getting the following error

Cannot read device /dev/loop0

Here's my strace output for the loop3 device:

(for a better paste -> pastebin)

munmap(0xb7845000, 4096)                = 0
mlockall(MCL_CURRENT|MCL_FUTURE)        = 0
getpriority(PRIO_PROCESS, 0)            = 20
setpriority(PRIO_PROCESS, 0, -18)       = 0
stat64("/dev/loop3", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 3), ...}) = 0
open("/dev/loop3", O_RDONLY|O_SYNC|O_DIRECT|O_LARGEFILE) = 3
ioctl(3, BLKSSZGET, 0xbff2ad84)         = 0
fstatfs64(3, 84, {f_type=0x1021994, f_bsize=4096, f_blocks=46077, f_bfree=46033, f_bavail=46033, f_files=46077, f_ffree=45421, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
fstat64(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 3), ...}) = 0
open("/proc/mounts", O_RDONLY)          = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7845000
read(4, "rootfs / rootfs rw 0 0\nnone /sys"..., 1024) = 873
stat64("/dev/shm", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=40, ...}) = 0
stat64("/var/run", {st_mode=S_IFDIR|0755, st_size=460, ...}) = 0
stat64("/var/lock", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=60, ...}) = 0
stat64("/lib/init/rw", {st_mode=S_IFDIR|0755, st_size=60, ...}) = 0
read(4, "", 1024)                       = 0
_llseek(4, 0, [0], SEEK_SET)            = 0
read(4, "rootfs / rootfs rw 0 0\nnone /sys"..., 1024) = 873
stat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/sys", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
stat64("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
stat64("/dev", {st_mode=S_IFDIR|0755, st_size=3540, ...}) = 0
close(4)                                = 0
munmap(0xb7845000, 4096)                = 0
read(3, "", 512)                        = 0
write(2, "Cannot read device /dev/loop3.\n", 31Cannot read device /dev/loop3.
) = 31
close(3)                                = 0
munlockall()                            = 0
setpriority(PRIO_PROCESS, 0, 0)         = 0
exit_group(-22)                         = ?

(for a better paste -> pastebin)

share|improve this question
    
Have you mapped a physical device to the loop device? What's the output of losetup -a? – MadHatter Jul 13 '12 at 10:22
    
losetup -a returns nothing. losetup -f outputs: /dev/loop0 – abstraction Jul 13 '12 at 10:28
up vote 6 down vote accepted

The lack of output from losetup -a, and that fact that losetup -f gives you the first free device as /dev/loop0, shows that you haven't yet associated that loopback device with any physical storage. What unused physical partition or LVM volume do you wish to use as the actual storage for your loopback encrypted device?

If it's, say, /dev/sd2a, then bind that to the loopback device with losetup /dev/loop0 /dev/sd2a, and try cryptsetup again.

share|improve this answer
    
thanks MadHatter it's working now :-) – abstraction Jul 14 '12 at 8:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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