Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: Using encrypted swap via cryptsetup-luks on amd64
Date: Sun, 22 Oct 2006 19:43:26
Message-Id: ehghck$590$1@sea.gmane.org
In Reply to: Re: [gentoo-amd64] Re: Using encrypted swap via cryptsetup-luks on amd64 by Jason Booth
1 Jason Booth <jbooth@××××××××××××××××.net> posted
2 200610221115.22864.jbooth@××××××××××××××××.net, excerpted below, on Sun,
3 22 Oct 2006 11:15:22 -0600:
4
5 > On Sunday 22 October 2006 06:16, Richard Freeman wrote:
6 >> I'd just make SWAPDEVICE and LOOPDEV command-line parameters and then
7 >> call the script 4 times.
8 > or drop a for loop into it...
9 >
10 > I don't know much about raid, but if it's treated in /dev as a single device,
11 > you may just be able to replace it and go.
12
13 The neat thing about swap is that the kernel stripes it on its own -- no
14 raid drivers needed. You just mount the raid swap partitions and set all
15 the ones you want striped to the same priority (I use pri=1), and the
16 kernel will do the rest on its own. If they are all the same size, great,
17 if not, it'll stripe them until the smallest one is gone then it'll stripe
18 the remainder, again all automatically.
19
20 (Striping means it writes a few bytes, maybe the standard half-kb
21 block tho in the case of swap tho I'm not sure, to the first device, then
22 the next block to the second, the third block to the third, etc. Because
23 bus speed is far faster than physical disk write speed, with four disks by
24 the time you've sent the data to the fourth one, the first is pretty much
25 done actually writing it to disk and ready for more again, so the data is
26 written out and read in at bus speed rather than at bus speed until the
27 cache on the drive fills up or empties, then at drive speed. The caveat
28 with pure striping, aka raid-0, is that while it's much faster, it's not
29 redundant at all, the "r" in "raid" isn't! Thus if one disk goes out, you
30 lost what amounts to everything, tho of course a good data recovery place
31 can still recover say 3 out of every 4 blocks if it was a four-way stripe.
32 However, this isn't a problem as long as you don't need five-nines uptime
33 or the like -- if you want a bad drive to crash the system anyway, so you
34 know about it and can recover the non-raid-0 non-swap data on the other
35 drives due to the redundancy of the other raid formats.)
36
37 > May be overly paranoid, but writing encrypted data multiple times could help
38 > someone to guess what certain file is and make an attack on the encryption
39 > easier. I use ext2 for my encrypted loops so there's no journal as well.
40 > Although the power fails sometimes, and can be a pain to fsck, i haven't lost
41 > anything yet.
42
43 If one were using a non-striped raid, say raid-1 (mirrored), or raid-6
44 (striped minus two, which are parity, so a 4-way is 2-way striped plus two
45 parity, raid-6 allows you to lose any two of the drives), the data would
46 be redundant, but not in pure striped. A redundant raid form swap might
47 be used where uptime is critical and hot-swap drives are used, so the
48 system could continue running after a drive crashed, while it was
49 hot-swapped out. However, that's the big costly operation way of doing
50 things, not a hobbyist's way of doing things unless you are Mark
51 Shuttleworth or something, and going down to replace the drive is expected
52 here anyway, after which the swap could be reconfigured, so no big deal.
53
54 --
55 Duncan - List replies preferred. No HTML msgs.
56 "Every nonfree program has a lord, a master --
57 and if you use the program, he is your master." Richard Stallman
58
59 --
60 gentoo-amd64@g.o mailing list