0

I'm trying to overwrite a file using:

cp source.txt target.txt

But I get "No space left on device".

I also tried using dd with no success, even with super user.

How can I overwrite using only the space used by the target file?

  • Is source larger than target? – Jeff Schaller Aug 30 '18 at 23:46
  • Did you use dd … >  or dd … of=? – G-Man Aug 31 '18 at 0:02
  • What operating system is this? What filesystem? The reasons for getting that issue may very well depend on those. – ilkkachu Sep 1 '18 at 19:44
0

If you have it installed:

$ truncate -s 0 target.txt

Will reduce the file size to zero.

And, maybe:

$ : > target.txt

But perhaps it is a problem with the journal being unable to write to disk. In that case, you need to log in as root to remove some files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.