3 ms·
cp file.iso /dev/sda
by akdev1l 20d ago
cp file.iso /dev/sda
- ewy1 20d agothis works great but in my experience sometimes you should add && sync not sure why it's necessary only sometimes!
- rascul 20d agoThe kernel has a cache used for block devices. If you want to be more targeted: blockdev --flushbufs /dev/sda
- WhyNotHugo 20d agoThis isn't portable though, it's a GNU-specific "smart" things. Elsewhere, this overwrites the target device file.
- jasomill 20d agoRedirection doesn't overwrite device files, so cat foo.img > /dev/sda works and should be portable. No control over the buffer size, though.
- LtWorf 19d agoAnd no printing of progress either.
- akdev1l 20d agoHow exactly is cp not portable? Whatever behaviour you’re describing is not how POSIX mandates cp to work. In fact you can do this with busybox too. cp will open("/dev/sda", O_WRONLY | O_TRUNC) and simply start writing to that file descriptor.
- deleted 20d ago[deleted]