3

I have an Ubuntu 16.04 LTS desktop system that I use to rescue disk drives (using dd or ddrescue). Whenever I plug in a disk drive it is automatically mounted and shown in the file manager.

I don't want this because I am afraid of the disk to be rescued is modified by the mounting process. It is me who decides if and when that disk is mounted, and not some OS function.

Surprisingly I could not find a setting to deactivate the auto-mount function. Some solutions suggest to enter the affected partitions in /etc/fstab and disable mounting there, however as each disk drives to be rescued may have different partitions this is not going to work in my case.

How to fully disable the auto mount feature of Ubuntu?

  • 1
    Good question, but I don't think it belongs on Server Fault. Would be a better fit for Ask Ubuntu or Unix & Linux. I have voted to migrate the question. – kasperd Dec 11 '16 at 19:24
  • I'd suggest you gogle for linux forensic distribution there are better choices for your task. For ubuntu a search for dsiable automount gets you some hits. – LotPings Dec 11 '16 at 22:44
1

The core of the automount system is probably the udisks system. The daemon process should be udisksd and the systemd service might be udisks2.service (at least on my Debian 9; the name might vary on Ubuntu).

Once you stop that service (e.g. with systemctl stop udisks2.service) the GUI session should be unable to auto-mount anything.

To make sure any other service does not reactivate it, you could mask it: systemctl mask udisks2.service.

  • sudo systemctl stop udisks2.service correctly disabled automount for my session in a 64-bit XUbuntu Linux version 16.04 (a.k.a. "Xenial Xerus"). – Yuri Sucupira Nov 3 at 3:16
0

So you want to recover disks without messing with their contents. Yes, mounting their filesystems will increment counters, and possibly damage an already damaged filesystem.

In this case you can't just run dd on a disk to prevent this from happening, because by the time you plug it in that system has already automatically mounted it. You will be using the new udisks system to auto-mount new volumes based on udev events. You can turn this functionality off entirely in your GUI.

Within "Settings" > "Removable Drives and Media": uncheck all of the "removable storage" boxes. This should disable the feature entirely.

  • I can't find the "Settings" > "Removable Drives and Media" dialog you are mentioning. My Ubuntu system has a "System Settings" dialog but that page does not have a "Removable Drives and Media" dialog. I found a "Details" program having a "Removable Media" dialog but the "removable storage" check boxes do not exist. – nn4l Dec 11 '16 at 19:05
  • Running sudo systemctl stop udisks2.service in the shell prior to connecting the defective device solves it in a Ubuntu system (I'm using the 64-bit XUbuntu 16.04 distro). The command dd should not be used for copying the contents of a defective drive: ddrescue should be used instead. Example: ddrescue -Adf -r 3 -v /dev/sdb1 sdb1.iso will attempt to copy partition 1 of disk sdb to a file sdb1.iso placed in the directory where such command is run. Running photorec sdb1.iso will cause photorec to read and copy the contents of sdb1.iso to the directory where such command is run. – Yuri Sucupira Nov 3 at 3:22

Your Answer

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