Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #90457
| From | "Carlos E.R." <robin_listas@es.invalid> |
|---|---|
| Newsgroups | comp.os.linux.misc |
| Subject | Re: Overwriting with random data |
| Date | 2026-08-24 20:34 +0200 |
| Organization | Tebibyte_Retro_Gaming |
| Message-ID | <vefulmxca.ln2@Telcontar.valinor> (permalink) |
| References | (8 earlier) <5b2dnb6l8sPvPhf3nZ2dnZfqnPGdnZ2d@giganews.com> <6d3rlmxqg4.ln2@Telcontar.valinor> <116fs5p$28rhg$2@dont-email.me> <6r8tlmxeb9.ln2@Telcontar.valinor> <116h5be$2nco1$1@dont-email.me> |
On 2026-08-24 12:10, Nuno Silva wrote:
> On 2026-08-24, Carlos E.R. wrote:
>
>> On 2026-08-24 00:28, vallor wrote:
>>> At Sun, 23 Aug 2026 13:50:30 +0200, "Carlos E.R." <robin_listas@es.invalid> wrote:
>>
> [snipping a lot to keep this shorter, apologies if I ended up snipping
> too much]
>>
>>>> I wrote a program that writes bytes on big partitions.
>>>>
>>>>
>>>> excerpted:
>>>>
>>>> const
>>>> sourcefilename = './BigRandom';
>>>> rawdest: string = ''; // example: '/dev/sda11'
>>>>
>>>> shuflecount = 1024;
>>>> arraysize = 1023;
>>>> ChunkSz=1048576;
>>>> type
>>>> tCacho= array [1..ChunkSz] of byte;
>>>>
>>>> var
>>>> Fin, Fout: file of tCacho;
>>>> gotresult: Word;
>>>>
>>>> BigData : array [1..shuflecount] of tCacho;
>>>> OutputIndex : Int64; // counts MiB written.
>>>>
>>>>
>>>> begin
>>>>
>>>> // writes one MiB
>>>> {$I-}write(Fout,BigData[RandomIndex]);{$I+}
>>>> gotresult:= ioresult;
>>>>
>>>>
>>>>
>>>> The purpose of the program is to fast fill a partition or disk with
>>>> nearly true random data. It is as fast as dd could be.
>>>
>>> SHRED(1) User Commands SHRED(1)
>>>
>>> NAME
>>> shred - overwrite a file to hide its contents, and
>>> optionally delete it
>>>
>>> SYNOPSIS
>>> shred [OPTION]... FILE...
>>>
>>> DESCRIPTION
>>> Overwrite the specified FILE(s) repeatedly, in order to
>>> make it harder for even very expensive hardware probing
>>> to recover the data.
>>
>> Not the same thing.
>
> IIRC shred can do the same, and on block devices too, what's the
> difference here? block sizes?
I mentioned my code because it accesses huge devices in pascal, way
beyond 4G.
c186282 said:
Note Lazarus/FPC *says* it supports huge seek numbers
but DOESN'T ... limited to maybe 4gb.
Some functions work, others don't. This does not work:
const
rawdest: string = ''; // example: '/dev/sda11'
ChunkSz=1048576;
type
tCacho= array [1..ChunkSz] of byte;
var
Fin, Fout: file of tCacho;
begin
rawdest:= ParamStr(1);
writeln('Apparent size of ', rawdest, ' is ', filesize(Fout));
It writes '0' (I am currently erasing an 8TB disk)
Notice that I am not using a file of bytes, but a file of 1 MiB arrays.
And I am not using seek, but writing contiguously.
Now the shred part.
Using true random data is slow, specially if the disk or partition is
very big. Depends on how fast can the machine create new random data
(see man random and urandom). So I do tricks to do it faster. And shred
does it several times.
The algorithm I use is:
Fill a 1 GiB file with true random data.
Read that file into ram.
repeat
take 1 MiB of that and write it into the destination device
advance
Every 100 advances, replace 1 MiB of the array of random bytes
with new random data
until end of device
So, the data is truly random, but used repeatedly (and slowly renovated).
--
Cheers, Carlos.
ES🇪🇸, EU🇪🇺;
Back to comp.os.linux.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
/dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-19 21:20 +0000
Re: /dev/tcp Richard Kettlewell <invalid@invalid.invalid> - 2026-08-19 23:53 +0100
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-19 23:42 +0000
Re: /dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-20 00:59 +0000
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-20 03:59 +0000
Re: /dev/tcp Nuno Silva <nunojsilva@invalid.invalid> - 2026-08-20 10:10 +0100
Re: /dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-20 18:15 +0000
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-20 23:30 +0000
Re: /dev/tcp Nuno Silva <nunojsilva@invalid.invalid> - 2026-08-21 01:18 +0100
Re: /dev/tcp Marc Haber <mh+usenetspam2616@zugschl.us> - 2026-08-21 09:52 +0200
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-21 08:12 +0000
Re: /dev/tcp Marc Haber <mh+usenetspam2616@zugschl.us> - 2026-08-21 11:16 +0200
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-21 22:57 +0000
Re: /dev/tcp Marc Haber <mh+usenetspam2616@zugschl.us> - 2026-08-22 06:17 +0200
Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-21 21:50 -0400
Re: /dev/tcp Anssi Saari <anssi.saari@usenet.mail.kapsi.fi> - 2026-08-24 17:42 +0300
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-24 23:53 +0000
Re: /dev/tcp vallor <vallor@vallor.earth> - 2026-08-23 00:56 +0000
Re: /dev/tcp Rich <rich@example.invalid> - 2026-08-23 04:01 +0000
Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-23 03:37 -0400
Re: /dev/tcp "Carlos E.R." <robin_listas@es.invalid> - 2026-08-23 13:50 +0200
Re: /dev/tcp vallor <vallor@vallor.earth> - 2026-08-23 22:28 +0000
Re: /dev/tcp "Carlos E.R." <robin_listas@es.invalid> - 2026-08-24 09:35 +0200
Overwriting with random data (was: Re: /dev/tcp) Nuno Silva <nunojsilva@invalid.invalid> - 2026-08-24 11:10 +0100
Re: Overwriting with random data "Carlos E.R." <robin_listas@es.invalid> - 2026-08-24 20:34 +0200
Re: Overwriting with random data Richard Kettlewell <invalid@invalid.invalid> - 2026-08-24 20:57 +0100
Re: Overwriting with random data "Carlos E.R." <robin_listas@es.invalid> - 2026-08-24 22:26 +0200
Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-24 00:31 -0400
Re: /dev/tcp "Carlos E.R." <robin_listas@es.invalid> - 2026-08-24 09:45 +0200
Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-23 12:52 +0100
Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-23 12:50 +0100
Re: /dev/tcp Rich <rich@example.invalid> - 2026-08-20 13:50 +0000
Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-20 13:02 -0400
Re: /dev/tcp Rich <rich@example.invalid> - 2026-08-20 18:26 +0000
Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-21 13:54 +0100
Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-21 22:57 -0400
Re: /dev/tcp "Carlos E.R." <robin_listas@es.invalid> - 2026-08-22 21:47 +0200
The hammer is best (Was: /dev/tcp) gazelle@shell.xmission.com (Kenny McCormack) - 2026-08-22 23:50 +0000
Re: The hammer is best (Was: /dev/tcp) c186282 <c186282@nnada.net> - 2026-08-23 04:28 -0400
Re: The hammer is best Richard Kettlewell <invalid@invalid.invalid> - 2026-08-23 10:14 +0100
Re: The hammer is best "Carlos E.R." <robin_listas@es.invalid> - 2026-08-23 13:55 +0200
Re: The hammer is best The Natural Philosopher <tnp@invalid.invalid> - 2026-08-23 13:16 +0100
Re: The hammer is best Marc Haber <mh+usenetspam2616@zugschl.us> - 2026-08-23 21:20 +0200
Re: The hammer is best c186282 <c186282@nnada.net> - 2026-08-24 02:18 -0400
Re: The hammer is best The Natural Philosopher <tnp@invalid.invalid> - 2026-08-24 11:26 +0100
Re: The hammer is best Joed Oakes <lost@noway.home.invalid> - 2026-08-23 19:42 -0400
Re: The hammer is best Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-23 23:56 +0000
Re: The hammer is best c186282 <c186282@nnada.net> - 2026-08-24 02:25 -0400
Re: The hammer is best rbowman <bowman@montana.com> - 2026-08-24 01:14 +0000
Re: The hammer is best "Carlos E.R." <robin_listas@es.invalid> - 2026-08-24 09:50 +0200
Re: The hammer is best c186282 <c186282@nnada.net> - 2026-08-24 00:53 -0400
Re: The hammer is best rbowman <bowman@montana.com> - 2026-08-24 06:42 +0000
Re: The hammer is best c186282 <c186282@nnada.net> - 2026-08-24 23:34 -0400
Re: The hammer is best rbowman <bowman@montana.com> - 2026-08-25 04:08 +0000
Re: The hammer is best The Natural Philosopher <tnp@invalid.invalid> - 2026-08-24 11:28 +0100
Re: The hammer is best c186282 <c186282@nnada.net> - 2026-08-23 22:16 -0400
Re: /dev/tcp Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2026-08-21 13:41 +0100
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-21 22:58 +0000
Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-21 22:28 -0400
ksh (was: /dev/tcp) Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2026-08-24 13:56 +0100
Bash vs. ksh - Does it matter? And the 'vi' mode thing... (Was: ksh (was: /dev/tcp)) gazelle@shell.xmission.com (Kenny McCormack) - 2026-08-24 14:57 +0000
Re: ksh (was: /dev/tcp) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-24 21:08 +0000
Re: ksh (was: /dev/tcp) gazelle@shell.xmission.com (Kenny McCormack) - 2026-08-24 21:28 +0000
Re: ksh (was: /dev/tcp) rbowman <bowman@montana.com> - 2026-08-25 01:11 +0000
Re: /dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-20 18:22 +0000
Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-21 13:57 +0100
Re: /dev/tcp Lars Poulsen <lars@beagle-ears.com> - 2026-08-23 06:37 -0700
Re: /dev/tcp Richard Kettlewell <invalid@invalid.invalid> - 2026-08-23 14:49 +0100
Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-23 16:13 +0100
Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-23 22:31 +0000
Re: /dev/tcp Richard Kettlewell <invalid@invalid.invalid> - 2026-08-24 19:08 +0100
csiph-web