On 2017-04-13 09:15, Mark Morgan Lloyd via Lazarus wrote: > On 12/04/17 21:30, Carlos E. R. via Lazarus wrote: >> Hi, >> I'm new on this list, so if I should post this to a different place, >> just tell me. >> I want to find a function that I can use on Linux to write a memory >> block to an arbitrary position on a device, say, /dev/sda or /dev/sda5 . >> I can do that on an opened file with seek() and write(), but apparently >> only on files. I need accessing the raw disk device. So currently I call >> 'dd' instead. >> I also had problems with blockread/write: it failed reading more than >> one megabyte. > > That's interesting, I need to look at some medium testing stuff over the > next few days and was assuming I'd need to check the dd sources. Are you > running as root to get direct access to the device?
Thanks for responding. :-) I had and idea, tried it, and it worked. I simply assign: assign(Fout, '/dev/sdc'); Reset (Fout); The file can be a file of bytes, or in my case, a typed file (of an array). Works perfectly, I can write chunks at 180 MiB/s. :-) For writing to some position, I assume I could use Seek(). I haven't tried. Yes, of course, even for testing you need being root to run the code. So the IDE runs as my user, the code in another terminal as root. Scary, because I write directly to /dev/sdc (I'm filling the disk with random data fast, prior to encrypting it. 7 hours for a 4TB disk). Perhaps I could instead chmod or chown the device [...] Yes, it works, better! It is undone on reboot, but that doesn't matter. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" at Telcontar)
signature.asc
Description: OpenPGP digital signature
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus