I'm trying to use the following command:dd if=/dev/urandom of=/dev/sg11 bs=16K count=1But when executing it, I get the following error:dd: writing `/dev/sg11': Function not implementedWhen I try with dd if=/dev/urandom of=/dev/sg11 bs=16K count=1 conv=fsync, then I get a cannot allocate memory error, which becomes a Function not implemented error when I up the bs size.What causes this issue and how can I fix it?UPDATE: Sometimes it will tell me cannot allocate memory, and then it will again tell me that function not implemented for the same bs value.
dd outputting: function not implemented when trying to write to /dev/sg11
devices;dd;scsi
/dev/sgxx is a SCSI-generic device, which allows sending and receiving of raw SCSI commands. When you write to the device, you are expected to start the write with a SCSI header, which defines the operation you wish to do.Writing random data to an sg device is really a bad idea. You'll be sending random SCSI commands, which might not even exist (hence function not implemented) and furthermore giving a random byte length for the operation, which is highly likely to result in cannot allocate memory. (If you're really unlucky, the random command might do something.)Depending on what device you actually have connected to /dev/sg11, you might want to investigate the sg3_utils package, or some more specific SCSI device driver like st (tape drives).One of the useful utility commands which comes with the sg utils is sg_map, which can let you know what the primary device corresponding to an sg device. On non-ancient Linux systems, you can also install lsscsi which provides a nice listing of SCSI devices, again with both the /dev/sg device and the primary device.sg3_utils also includes sg_dd which is a version of dd which understands the low-level SCSI protocol. (But only use it if you know what you're doing!)