Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question consists of two parts:

How to find out what is the writing mode of ext4?

How to configure an existing ext4 (a journaling file system) to do writes to a file in place such that shredding/wiping can be effective.

share|improve this question
up vote 1 down vote accepted

Ext[234] always does update in place. You don't have to do anything.

share|improve this answer
You may have misunderstood the question (or maybe it was me). Note: "such that shredding/wiping can be effective", the question is about how to make the file system overwrite, delete and update files instead of just changing the inodes and metadata. – Stefano Palazzo Jan 20 '11 at 19:41
Yes, and my answer is that is the normal way things work. If you open a file and overwrite its contents, then it is overwritten in place. – psusi Jan 20 '11 at 21:46
Correct, that's the ext4 default: data=ordered (*) All data are forced directly out to the main file system prior to its metadata being committed to the journal. – m33lky Jan 21 '11 at 5:07
However, I'm still not entirely sure what happens during multiple shredding passes: does the file system commit just the last version similar to the way dirty pages are saved? – m33lky Jan 21 '11 at 5:12
shred forces the data out between passes. – psusi Jan 21 '11 at 21:12

I'm not sure this accurately answers the question. If a file is open for reading (say, by a shared library with its contents loaded in memory), you really don't want those contents over-written unexpectedly. So, I believe the normal way (ie when data=ordered) is to write the data to disk, update the inodes/metadata, point the directory entry to the new file, but leave the old file in-place and allocated until all references to it are removed (that is, all processes have released any file_open handles).

In that case, shred/wipe might force an fsync, but the old file is still very much active which means it won't get shredded.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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