# USB OTG- No Option To Unmount



## shag_on_e (Aug 1, 2011)

I've been using USB OTG quite a bit lately since getting the adapter, but I've noticed that there isn't an option to unmount the usbdisk in AOKP at least. Before y'all say it, I've used all the apps that allow for mounting and unmounting the disk, but since LeanKernel supports OTG it mounts the drive to /storage/usbdisk while the apps try to mount it at /sdcard/sda1 or something similar, but the data isn't there so using the unmount option in the app is futile and pulling the usbdisk results in com.media force close and a status bar message saying something like "unexpected media removal" due to not unmounting. I've tried several terminal commands to unmount the block but none have worked so far. Any ideas? Thanks folks.

~~~~There is no spoon~~~~


----------



## shag_on_e (Aug 1, 2011)

Wow, I suppose this is a real stumper!

~~~~There is no spoon~~~~


----------



## milan616 (Jun 21, 2011)

I just spent some time with it and can't get it to unmount it either. Very interesting.


----------



## shag_on_e (Aug 1, 2011)

milan616 said:


> I just spent some time with it and can't get it to unmount it either. Very interesting.


I've provided a logcat, dmesg, and full description in the AOKP section, apparently no one uses this feature. I personally consider it a necessity since storage is limited to like 28 gb. With tons of pictures and music and other downloaded stuff, I stay on the verge of full constantly. Hopefully someone can at least point me to a terminal command I can make a widget out of to unmount.

~~~~There is no spoon~~~~


----------



## craigacgomez (Jan 17, 2012)

```
# su<br />
# umount /storage/usbdisk
```
or

```
# umount -f /storage/usbdisk
```
but it may change depending on the vold.fstab in the ROM... Let me get back in an hour or so with a more ROM independent command!!


----------



## shag_on_e (Aug 1, 2011)

craigacgomez said:


> ```
> # su<br />
> # umount /storage/usbdisk
> ```
> ...


I've already tried umount /storage/usbdisk doesn't work. I'll try the force command in a bit. Thanks for the help.

~~~~There is no spoon~~~~


----------



## milan616 (Jun 21, 2011)

Force didn't work for me either. The stock umount doesn't support options, the busybox one does, neither worked for me.


----------



## shag_on_e (Aug 1, 2011)

milan616 said:


> Force didn't work for me either. The stock umount doesn't support options, the busybox one does, neither worked for me.


Yep, nothing is working. I'm yet to see anyone with insight chime in, but finally some others are confirming in other threads I've started, so hopefully someone can shed some light.

~~~~There is no spoon~~~~


----------



## craigacgomez (Jan 17, 2012)

Well, I got it working with this... /dev/block/vold/8:1 is the usb disk...


```
<br />
# su<br />
# umount `mount | grep /vold/8:1 | awk '{ print $2 }'`<br />
```


----------



## shag_on_e (Aug 1, 2011)

craigacgomez said:


> Well, I got it working with this... /dev/block/vold/8:1 is the usb disk...
> 
> 
> ```
> ...


Oooh shit! Yeah I never would've came up with that! Gonna try now!
~~~~There is no spoon~~~~


----------



## shag_on_e (Aug 1, 2011)

craigacgomez said:


> Well, I got it working with this... /dev/block/vold/8:1 is the usb disk...
> 
> 
> ```
> ...


Hey bro, can you clarify that command a little? I tried it as I see it but it still did nothing. If it worked to unmount the usbdisk for you, I must've mistyped something. I'm going to try using TWRP(since it supports OTG) to mount and unmount the disk, then copy the recovery log to the sdcard, hopefully gain some insight. Thanks man.

~~~~There is no spoon~~~~


----------



## craigacgomez (Jan 17, 2012)

Well, it's sorta a mashup of 2 commands...

First command -> mount | grep /vold/8:1 | awk '{ print $2 }' - this uses the mount command to list the active mounts, then uses grep to remove all lines except the USB disk volume, then uses awk to get the second column of the line which is the mount location

I then use the output of the first command as the parameter for the umount command


----------



## shag_on_e (Aug 1, 2011)

craigacgomez said:


> Well, it's sorta a mashup of 2 commands...
> 
> First command -> mount | grep /vold/8:1 | awk '{ print $2 }' - this uses the mount command to list the active mounts, then uses grep to remove all lines except the USB disk volume, then uses awk to get the second column of the line which is the mount location
> 
> I then use the output of the first command as the parameter for the umount command


Man this sucks. I couldn't get the command to produce output. A new update: I've gone through three popular kernels now(Franco, LeanKernel, and faux) attempting to use stickmount to unmount usbdisk. LeanKernel(exp5) and faux(22b2) mount the drive, ignoring stickmount, and can't be unmounted. Franco let stickmount mount the drive first, but eventually a conflict arose and the drive was kicked off by itself. This is crazy. The next person that says "use Stickmount" is gonna make me flip out.

~~~~There is no spoon~~~~


----------



## craigacgomez (Jan 17, 2012)

Any output when you use this?

```
mount | grep /vold/8:1 | awk '{ print $2 }'
```
or can you post the output of the "mount" command?


----------



## shag_on_e (Aug 1, 2011)

craigacgomez said:


> Any output when you use this?
> 
> ```
> mount | grep /vold/8:1 | awk '{ print $2 }'
> ...


No I don't any output from that command, beside it telling me to correctly use the mount command " mount ". I'll post the mount output in a minute, but I've found that "umount /mnt/usbdisk" successfully umounts the drive, but I still get the com.android.media force close which also causes media to wakelock until reboot. So I'm thinking there needs to be some editing to vold.fstab, but I don't know what exactly to add/change. In AOKP, it looks like OTG is the only thing in vold.fstab, so maybe if we add the internal sdcards path and sources it won't keep thinking I'm removing the non-removable internal sdcard.~~~~There is no spoon~~~~


----------

