How to rescan and remount drives on Ubuntu Hardy or Jaunty?

7

When I connect an USB drive to an Ununtu Hardy and Jaunty system, the system mounts the partitions found on the drive, and opens a Nautilus window for each mounted partitions. Within Nautilus, I am able to unmount partitions.

What I need is a command or action which forces the system to rescan the available drives and partitions, and automount each not mounted partition, including those which I've manually unmounted from Nautilus. sudo /etc/init.d/udev restart or ... reload doesn't do this.

As of now, I just unplug the USB drive, and commect it again, which will force a scan and a mount on that drive. But I want to do force the rescan and remount without unplugging anything, preferably without the user having the know device or drive names.

pts

Posted 2009-12-27T12:20:24.653

Reputation: 5 441

Answers

3

Try triggering the add rule to udev. The default action is add. ( probably what you want)

# udevadm trigger --subsystem-match=block

you can call

# udevadm settle --timeout=60

to wait for udev to finish doing it's thing. (in this case 60 seconds, default is 180seconds)

Tim Williscroft

Posted 2009-12-27T12:20:24.653

Reputation: 675

Sorry, neither of these commands work. After trying them, and waiting for something to happen, and giving up, I had to disconnect the USB cable, and connect it again to make udev recognize the device. Do you have a command which you have tried and it works? – pts – 2010-12-21T23:24:26.053

2

sudo unmount -a and sudo mount -a will do the job,but only if the device is not busy(in use). All of the file systems described in /etc/mtab are mounted or unmounted.But after I tried it with USB,It turned out be OK.

schemacs

Posted 2009-12-27T12:20:24.653

Reputation: 334

Note that the command to unmount is mistyped, it's actually umount – drodsou – 2015-05-20T09:39:12.383

1You wrote twice "mount". Did you mean one of them to be "unmount"? – Gnoupi – 2010-08-15T07:13:25.310

I am sorry,that is a typo.I have corrected it. – schemacs – 2010-08-16T09:54:36.697

I can't accept this answer, because it has a side effect that it umounts already mounted partitions. I need a solution which doesn't touch existing mounts. – pts – 2010-12-21T23:20:10.813