To view parent comment, click here.
To read all comments associated with this story, please click here.
I realize the above is correct behavior... What bothers me is that (by default anyway) is that it can be used by a limited user to create an an effective denial-of-service attack. Stalling or crashing a multiuser system should IMO (ideally) be something that root, and only root, can do.
OTOH, the presence of tools like dd is why I much prefer Linux to Windows. Experienced users shouldn't have to jump through hoops to do simple things.
Edit: re swap, I wish there were a way of hibernating without it. In my experience it is not very helpful, even on low-memory systems.
Edited 2012-10-27 18:44 UTC
Gullible Jones,
"What bothers me is that (by default anyway) is that it can be used by a limited user to create an an effective denial-of-service attack."
I see your point. You can put hardlimits on a user's disk/cpu/ram consumption, but that can easily interfere with what users want to do. I'm not sure any system can distinguish between legitimate resource usage and accidental or malicious usage?
At university some ten years ago, we were using networked sun workstations, I'm sure they'd know something about distributing resources fairly to thousands of users. I don't remember the RAM capacity/quotas, but I do remember the disk quota because I ran into it all the time - soft limits were like 15MB, uck!
mv `which dd` /sbin/
problem solved.
Edited 2012-10-27 20:18 UTC





Member since:
2011-01-28
Gullible Jones,
The OP's clearly trolling, but you post an interesting question.
"$ dd if=/dev/zero of=~/dumpfile bs=4G count=1"
I don't get your result, it says "invalid number" for any value over 2G, probably because it's using a 32bit signed int to represent the size (on a 32 bit system).
"Mind you, Windows is just as bad about this - it just doesn't have tools like dd preinstalled that can easily crash your computer."
My own opinion is that this is a case of garbage in, garbage out. dd is a powerful tool and was not designed to second guess what the user wanted to do. You've asked it to allocate a huge 4GB buffer, fill that buffer with data from one file, and then write it out to another. If it has enough ram (including swap?) to do that it *will* execute your request as commanded. If it does not have enough ram, it will fail, just as expected. It's not particularly efficient, but it is doing exactly what you asked it to do. Windows behaves the exact same way, which is the correct way.
You could use smaller buffers, or use a truncate command to create sparse files. Maybe we could argue that GNU tools are too complicated for normal people to use, but lets not forget that the unix command line is in the domain of power users, most of us don't really want our commands to be dumbed down.
"(If you don't have swap space, the command will fail because you don't have enough memory. But it's not safe to run without swap space... right?)"
I don't believe in swap
Look at it this way, if a system with 2GB ram + 2GB swap is good enough, then a system with 4GB ram + 0 swap should also be good enough. I get that swap space is so cheap that one might as well use it "just in case" or to extend the life of an older system, but personally I prefer to upgrade the ram than rely on swap.
Edited 2012-10-27 18:38 UTC