1 |
Duncan wrote: |
2 |
|
3 |
>> and, if you have experiences with it, do you know what could happen |
4 |
>> without fsck on an unsafely unmounted luks partition? |
5 |
> |
6 |
> Luks I know nothing of. Someday when I get the appropriate round tuit... |
7 |
|
8 |
I just gave it a try with a 32 megabyte SD card on my laptop. I set up |
9 |
the LUKS volume like so: |
10 |
|
11 |
root@windbringer ~:# cryptsetup -v -y -c aes-cbc-essiv:sha256 luksFormat |
12 |
/dev/mmcblk0p1 |
13 |
|
14 |
...opened it: |
15 |
|
16 |
root@windbringer ~:# cryptsetup luksOpen /dev/mmcblk0p1 test |
17 |
|
18 |
...but I wasn't able to create a ReiserFS file system: |
19 |
|
20 |
root@windbringer ~:# mkreiserfs -d /dev/mapper/test |
21 |
|
22 |
[credits from mkreiserfs snipped] |
23 |
|
24 |
Guessing about desired format.. Kernel 2.6.28 is running. |
25 |
reiserfs_create_journal: cannot create a journal of 8193 blocks with 18 |
26 |
offset on 7456 blocks |
27 |
|
28 |
Oops. Too small a device, I guess. So, I tried EXT3: |
29 |
|
30 |
root@windbringer ~:# mkfs.ext3 -c -L test -v /dev/mapper/test |
31 |
... |
32 |
root@windbringer ~:# mount /dev/mapper/test /mnt/disk_image |
33 |
|
34 |
To see what would happen, I copied a load of .jpg files over to the card |
35 |
so there would be a test data set: |
36 |
|
37 |
root@windbringer ~:# cp ~drwho/*.jpg /mnt/disk_image |
38 |
|
39 |
Then I yanked the SD card out of the slot without unmounting it or |
40 |
running the luksClose command of cryptsetup. Much to my surprise, |
41 |
nothing complained about it. Upon reinserting it, however, the |
42 |
following appeared in the kernel message buffer: |
43 |
|
44 |
... |
45 |
mmc0: card cb93 removed |
46 |
Buffer I/O error on device dm-3, logical block 539 |
47 |
lost page write due to I/O error on dm-3 |
48 |
Aborting journal on device dm-3. |
49 |
Buffer I/O error on device dm-3, logical block 369 |
50 |
lost page write due to I/O error on dm-3 |
51 |
journal commit I/O error |
52 |
mmc0: new SD card at address cb93 |
53 |
mmcblk1: mmc0:cb93 S032B 29.6 MiB |
54 |
mmcblk1: p1 |
55 |
|
56 |
Nautilus prompted me to enter the LUKS passphrase to open the device; |
57 |
checking the kernel message buffer showed that the journal recovery was |
58 |
complete, and the volume could be properly read. I checked the files |
59 |
and none of them were corrupted. Next test: delete a few files, don't |
60 |
run sync(1), yank the card, and try again. Kernel output: |
61 |
|
62 |
... |
63 |
mmc0: card cb93 removed |
64 |
Buffer I/O error on device dm-4, logical block 419 |
65 |
lost page write due to I/O error on dm-4 |
66 |
Aborting journal on device dm-4. |
67 |
Buffer I/O error on device dm-4, logical block 369 |
68 |
lost page write due to I/O error on dm-4 |
69 |
journal commit I/O error |
70 |
ext3_abort called. |
71 |
EXT3-fs error (device dm-4): ext3_put_super: Couldn't clean up the journal |
72 |
Remounting filesystem read-only |
73 |
|
74 |
After plugging the card back in: |
75 |
|
76 |
... |
77 |
mmc0: new SD card at address cb93 |
78 |
mmcblk1: mmc0:cb93 S032B 29.6 MiB |
79 |
mmcblk1: p1 |
80 |
kjournald starting. Commit interval 5 seconds |
81 |
EXT3 FS on dm-4, internal journal |
82 |
EXT3-fs: recovery complete. |
83 |
EXT3-fs: mounted filesystem with ordered data mode. |
84 |
|
85 |
The deletions that took place before I pulled the card seemed to stay |
86 |
deleted when the journal was replayed. I did this four more times to |
87 |
see what would happen, and I didn't encounter any file system corruption. |
88 |
|
89 |
I haven't tried any other file systems yet, but if there is sufficient |
90 |
interest I'll start walking through the contents of `cat |
91 |
/proc/filesystems | grep -v ^nodev` |
92 |
|
93 |
-- |
94 |
|
95 |
The Doctor [412/724/301/703] |
96 |
|
97 |
PGP: 0x807B17C1 / 7960 1CDC 85C9 0B63 8D9F DD89 3BD8 FF2B 807B 17C1 |
98 |
WWW: http://drwho.virtadpt.net/ |
99 |
|
100 |
"My faith protects me. My Kevlar helps." --Michael Carpenter, _Death Masks_ |