Gentoo Archives: gentoo-user

From: Joshua Murphy <poisonbl@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Re: dd - bytes at a time
Date: Mon, 21 Dec 2009 04:03:11
Message-Id: c30988c30912201939saae475bu8b594b7704d526fd@mail.gmail.com
In Reply to: Re: [gentoo-user] Re: dd - bytes at a time by Neil Bothwick
1 On Sat, Dec 19, 2009 at 10:15 AM, Neil Bothwick <neil@××××××××××.uk> wrote:
2 > On Sat, 19 Dec 2009 12:11:27 +0000, Stroller wrote:
3 >
4 >> > Incidentally, if you want to use dd, adding bs=4096 speeds it up quite
5 >> > significantly.
6 >>
7 >> Thank you. I have always wondered what the optimal bs might be.
8 >> And why - could you possibly explain that, please?
9 >>
10 >> Is bs=4096 best for all disk-based operations?
11 >
12 > Many filesystems are set up with 4K blocks, so matching this with dd is
13 > more efficient. The default is 512 byte blocks and anything larger
14 > than this is good, I sometimes use 40960 but that isn't significantly
15 > faster. I prefer to avoid using dd on hard disks altogether, it's just
16 > so damn slow for large amounts of data.
17 >
18 >
19 > --
20 > Neil Bothwick
21 >
22 > You can't teach a new mouse old clicks.
23 >
24
25 My *completely uneducated* guess would be that, for a raw disk level
26 copy (on a normal spinning disk) or write a bs that is *at the least*
27 divisible into the drive's cache size, and at best *is* the drive's
28 cache size, would be best. For SSDs, if you have some strange reason
29 to need to use dd with one (I'd avoid it simply because a: you'll
30 never guarantee an overwrite of what's really there now and b: you'll
31 be put at least a small dent in the lifespan of the drive) the minimum
32 erase block size would be best, since that'd allow both a full erase
33 and a full write of a block, rather than risking 2 erases to get all
34 of one block written.
35
36 I do reiterate that this is all mere conjecture, and is based in my
37 likely flawed conceptual understanding of the drives.
38
39 --
40 Poison [BLX]
41 Joshua M. Murphy