There are two reasons you would want to prevent Linux from writing anything to an external harddrive or USB drive when you plug it in:
- To recover accidentally deleted files from now "empty" part of the drives
- For digital forensics, you need to be certain nothing on the drive has changed when you make a clone of it
There are drive connectors and external enclosures just for this purpose, and have a switch or button on them which physically blocks any write commands from reaching the drive.
However, my USB-to-IDE connector doesn't have that luxury. I have heard this is possible to achieve by software instead (which would include having to disable Ubuntu's auto-mounting), but I'm not finding any instructions online on how to do this.
How do I prevent Ubuntu from writing anything to an external harddrive for the purposes of preserving all data on it?
In my particular case I will be using Ubuntu, however, I asked on Unix & Linux rather than AskUbuntu in the hope of finding an answer that would work across distributions, and not just in my particular case. Both types of answers are welcome.
/etc/fstab
and set a read-only mount option for that UUID? – Arkanon Mar 13 '15 at 19:19RW
. You could try a distro on a live CD that has a forensics mode. Kali or Ubuntu Rescue Remix come to mind. Or perhaps someone will know how to edit fstab so that all future drives that are inserted are mountedRO
but I searched the man page and didn't have any luck :( – Dylan Mar 13 '15 at 19:58