2

I have an old ext4 disk partition that I have to investigate without disturbing it. So I copied the complete partition to an image file and mounted that image file while continuing my investigation.

Now while I do not write to the mounted filesystem, I do have to mount it with read/write access, because one of the programs makes assumptions on what I intend to do, and requires write access, even though I do not intend to write to it. You know the kind of 'smart' programs.

Now the problem is that, when mounting an ext4 filesystem read/write, the last mount point is written into the filesystem itself, i.e. the mount command changes my image file, including file access time and file modification time. That is annoying for a lot of other reasons. I cannot find an option in mount(8) nor in ext4(5) to avoid this.

Is there another way to mount with read/write access, without the mount command writing to the filesystem?

  • 6
    I don't have enough practical experience with it to properly suggest it, but OverlayFS could be useful to put a writeable separate layer over your image file. – Ulrich Schwarz Feb 17 at 16:06
  • I don't know about the "write the last mount point" issue, but the lazytime option should at least inhibit the on-disk update of atime/mtime/ctime. – AdminBee Feb 17 at 16:08
  • This isn’t all that helpful, but on Ext4, the mount point is stored the first time a file is opened in a file system, not when the file system is mounted. – Stephen Kitt Feb 18 at 10:20
  • @AdminBee I use the noatime mount option; mtime and ctime won't change as long as I don't create or modify files, I guess. – db-inf Feb 20 at 13:12
  • @StephenKitt Not immediately helpfull, but interesting. – db-inf Feb 20 at 13:13
2

I agree with @UlrichSchwarz mount it read-only, then use overlayFS or unionFS to create a writeable file-system. You can make the writable layer (the bit where the modifications go, disposable, or persistent. Ether way the changes are not stored on the master file-system.

| improve this answer | |
0

You can try with the mount option noatime. See man mount:

noatime
      Do  not  update inode access times on this filesystem (e.g. for faster
      access on the news spool to speed up news servers).  This works for all
      inode types (directories too), so it implies nodiratime.
| improve this answer | |

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.