View previous topic :: View next topic |
Author |
Message |
zhak n00b
Joined: 04 May 2015 Posts: 21
|
Posted: Fri Oct 16, 2015 10:09 am Post subject: dd if=/dev/urandom of=/dev/sda unstable bitrate |
|
|
I'm learning disk encryption, LUKS, and stuff atm, so I executed dd if=/dev/urandom of=/dev/sda. What I observe is bitrate instability: most of the time it is ~8MiB/s on my notebook, but it periodically drops to ~25KiB/s for a second or two every 200 MB or so. I wonder why is it happening? Does it tell me about some malfunction (problems with SSD or anything) or misconfiguration, or anything else? |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Fri Oct 16, 2015 10:21 am Post subject: |
|
|
urandom is way too slow to fill entire hard disks
if pseudorandom is good enough: shred -v -n 1 /dev/destroy
if encrypted random is good enough: cryptsetup plainOpen /dev/destroy cryptdestroy ; shred -v -n 1 /dev/mapper/cryptdestroy ; cryptsetup close cryptdestroy
even without AES-NI, crypto should be order of magnitude faster than urandom
In case of SSD, if you're planning to use TRIM, it's pointless in the first place. After TRIM it will just be zero again, so you can just as well trim the entire thing instead of overwriting: blkdiscard /dev/destroy
If you wish to stick to dd no matter what, always use bs=1M - dd uses only 512 byte blocksize by default which is slow for sheer read()/write() syscall overhead. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Oct 16, 2015 12:04 pm Post subject: |
|
|
shred is fast
urandom => depends on the hardware. sigh
why do you want to use shred in teh first place? one pass with shred is more than enough, with one bit pattern, thats it.
an ordinary user will be unable to recover data an anyone else use a gun on our heard, or has the money to recover it. physics sigh.
question @ frostschutz => do you use trim with ssd => lvm container -> luks -> root ext4.
I am still not sure if trim is worth on my setup. partition was aligned according to gpt partition table tool. |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Fri Oct 16, 2015 1:06 pm Post subject: |
|
|
tw04l124 wrote: | question @ frostschutz => do you use trim with ssd => lvm container -> luks -> root ext4. |
In my case it's `SSD -> RAID 1 -> LUKS -> LVM -> LV -> XFS` but yes, I do use TRIM (as in fstrim in a weekly or monthly cron job). It works fine. |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Oct 16, 2015 1:29 pm Post subject: |
|
|
Sorry to hijack a topic:
Wikipedia: https://en.wikipedia.org/wiki/Trim_%28computing%29
Quote: | ot all filesystems make use of Trim. Among the filesystems that can issue Trim requests automatically are Ext4,[24] Btrfs,[25] FAT, GFS2,[26] JFS,[27] and XFS.[27] However, this is disabled by default due to performance concerns,[28] but can be enabled by setting the "discard" mount option. |
snip out of fstab. So i think trim is not needed on my box at all.
Code: |
#luks Volume
/dev/mapper/... / ext4 discard,noatime,commit=600,defaults 0 1
|
So any reason why you have to use trim on your side? |
|
Back to top |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Fri Oct 16, 2015 1:35 pm Post subject: |
|
|
Huh?
I prefer fstrim (trim weekly or monthly) over discard (trim instantly) flag.
trim is supposed to keep the SSD happy in the long term.
discard (trim instantly) is a short term measure and if you ever have an accident, you won't get your data back.
(with fstrim I can disable the cron job and then photorec or whatever) |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Fri Oct 16, 2015 1:42 pm Post subject: |
|
|
cool thanks.
made it clear. Basically way a) and way b) to do the same stuff. |
|
Back to top |
|
|
|