# [SOLVED] Ubuntu 10.04: how to unmount usb ext hdd using terminal



## gustav521 (Mar 2, 2011)

Hello everyone! Could someone say how to unmount a West. Digital 2TB usb ext hdd using the terminal? I am using Ubuntu 10.04, which was clean installed. When I try to unmount, I get a message that I can't, nor does it say I can "eject" the drive. Thank you all. -gustav521


----------



## wmorri (May 29, 2008)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Hi,

For starters are you using the desktop or server edition. Also, how are you trying to unmount the drive, is it with terminal or by right clicking on it?

Cheers!


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Hello wmorri, thank you for your quick reply! I am using the Desktop Edition

of Ubuntu 10.04. I am right clicking, and it is saying that it can not be 

stopped at this time. I asked re using the Terminal to unmount, because I 

was looking for a work-a-around to the problem that others are saying 

exists in 10.04, ie unmounting ext. usb hdd's. Thank you for your help! -gustav521


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Does anyone have any ideas?? Thanks. -gustav521


----------



## wmorri (May 29, 2008)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Gustav521,

Please give it a little time. Everyone that is on staff here has jobs or goes to school or has matters that take priority over the forum. I will try and get to this tomorrow when I have a little time.


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Hello "wmorri", sure thing! Was not aware of the situation, thanks. -gustav521


----------



## slyfth (Feb 20, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Have you tried disk utility in Administration/Preferences? (can't remember at the back of my mind)

Try to unmount the drive and then safely remove it.


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Hello everyone! I now remember that I was coping files to this ext hdd, when I inadvertently turned off the main pc! The ext hdd was still working at that time. How do I find the process accessing the hdd and turn it off?? Thank you! -gustav521


----------



## hal8000 (Dec 23, 2006)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

You have possibly corrupted the external hard drive by switching off whilst it was being accessed.

When rebooting Ubuntu, make sure that no windows are open that display the contents of the external hard drive.

With the external hard drive connected, open a terminal and post contents of
this command:

mount


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

I am trying to avoid mounting this ext hdd, because I don't want to 

worsen the corruption issue. So how will I be able to umount it safely, or 

kill the process using it?? Thank you! -gustav521


----------



## wmorri (May 29, 2008)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Hi,

You won't be mounting the hdd just by typing the command mount. There is more to it than that. I think that hal8000 just wants to see what drives it finds that can be mounted.


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Here is the output of the command mount. Thank you for the explaination!

~$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/william/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=william)
/dev/sdb1 on /media/Elements type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)

-gustav521


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

And this is the sudo fdisk -l output:

Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000357c0

Device Boot Start End Blocks Id System
/dev/sda1 * 1 30166 242304000 83 Linux
/dev/sda2 30166 30516 2810881 5 Extended
/dev/sda5 30166 30516 2810880 82 Linux swap / Solaris

Disk /dev/sdb: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00020fc3

Device Boot Start End Blocks Id System
/dev/sdb1 1 243202 1953511424 7 HPFS/NTFS

What can I do?? Thank you! -gustav521


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

I have used: sudo umount /dev/sdb1 ,but does that properly umount the drive?? Thank you -gustav521


----------



## hal8000 (Dec 23, 2006)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Your 2TB drive has been formatted with NTFS and there will probably be some corruption. 
The command "mount" lists mounted partitions and is mounted at /media/Elements.

From your terminal type this:


sudo umount /media/Elements

(note that elements has "E")
if it fails to unmount, force it with "f" switch:

sudo umount -f /media/Elements

if it fails copy and paste the error message.


----------



## gustav521 (Mar 2, 2011)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Your suggestion worked "hal8000", thank you! I can umount in the future, but can I run chkdsk somehow like you can in Windows to fix the errors?? 
And thanks to everyone else who helped too!
-gustav521


----------



## hal8000 (Dec 23, 2006)

*Re: Ubuntu 10.04: how to unmount usb ext hdd using terminal*

Ok, please mark as [solved] in your top line.

Boot into windows and connect your extl HDD. Run chkdsk or scandisk from windows,
it may be clean, if not windows should fix the errors for you.


----------



## gustav521 (Mar 2, 2011)

Hello "hal8000" and everyone again! I have now used: 
sudo umount /media/Elements to un-mount my West. Digital Elements 2TB ext. hdd several times now. I have also tried using the: System > Admin. > Disk Utility that "slyfth" mentioned to "Safe Remove" the drive, but this is the message I get when I try: 

Error detaching drive - An error occurred while performing an operation on "2.0 TB Hard Disk" (WD Ext HDD 1021): The device is busy - Details: One or more partitions are busy on /dev/sdb . 

Disk Utility says the drive is healthy, and all my files seem to be intact. Is there some way to identify the process that is using the drive and stop it?? 
Oh, I have not run chkdsk yet. Thank you all for your continuing help! -gustav521


your help! -gustav521


----------



## hal8000 (Dec 23, 2006)

gustav521 said:


> Error detaching drive - An error occurred while performing an operation on "2.0 TB Hard Disk" (WD Ext HDD 1021): The device is busy - Details: One or more partitions are busy on /dev/sdb .


The message says one or more partitions busy, as you only have a single partition
/dev/sdb1

then run command

lsof /dev/sdb1

This will show what files are using the disk.
Post back the results please.

Just make sure also that you have no open windows, nautilus explorer or terminals open that have accessed your disk.


----------



## gustav521 (Mar 2, 2011)

Hello "hal8000" & others: I ran chkdsk / r on my WD 2TB ext. hdd yesterday using the Win XP machine; it took 36 hours!! At stage 3 it found an error

with index $130, file #xyz. So now it has finished through stage 5, and the drive still won't umount safely, as it is being used by who-knows-what! I

tried both: lsof /dev/sdb1 and lsof /media/Elements and nothing happened. I want to get lsof to work. I've read up on it on Google, but it

won't work. So, I am still using sudo umount /media/Elementsl. The program I had been using was Deja Dup when I inadvertently turned off the

PC. Could it be Deja Dup is still trying to finish the "job"? Thanks for your help!. -gustav521


----------



## hal8000 (Dec 23, 2006)

Hi possibly, if you turn off a computer whilst data is being wrote to a hard drive then that data will be corrupted.
Its a massive problem with non journalled filesystem like NTFS and FAT32, and I cant think of a better way of destroying a hard drive.
All linux file sytems are journalled, an area is set aside that keeps track of the changes on the drive, and multiple copies are kept. In addition using file systems like ext3, ext4 and reiser have significant advantages as the inodes are much smaller
ext3 - Wikipedia, the free encyclopedia

What you need to do now is wait until the chkdsk has finished, then back up the data onto a CD-R or DVD.
If command
sudo umount /media/Elements

will not unmount, then open a terminal and type

ps -aux

in the list scroll through and see if there is an entry for Deja Dup, if yes it will have a
PID associated with it (second colomn). Typing

kill xxxx

where xxxx is the Process ID should kil Deja Dup. If the process is not running
and hard drive activity is non existant (verified by placing your hand on drive to see
if it is still spinning) then use the force option to unmount the drive:

sudo umount -f /media/Elements

which hopefully will unmount the drive. I've lost plenty of data in FAT32 and NTFS systems. I use windows only for gaming and never trust any stored data on any windows file system. All my flash drives, external drives have ext3 partitions and
I've never lost a single bit of data.


----------

