Ubuntu – safely remove using command line

mount

I have a external seagate 1TB USB hard disk. Every time I connect it to my computer it gets automatically mounted. While removing it I select safely remove option rather than unmount because I read somewhere that it is recommended.

I have two questions:-

  1. Is true that just unmounting can damage my hard disk. Should I always select safely remove option? (I know the difference between unmount and safely remove and I have also noted that unmounting removes it from file table entry but safely removing actually stops using it. The power supply LED goes off after safely removing which doesn't happen with unmount).

  2. The first question leads me to this!
    How do I `safely remove my hard disk from command line?

(I know how to umount it.. but even if I unmount it it is still shown in fdiks -l
I don't want that)

Best Answer

Try this. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo umount /dev/<device_id> 

addition/correction (if you want to go by device uuid, i.e. not something like "sda3" but rather its unique long numeric/hex string like "366A52F225612...") use

sudo umount /dev/disk/by-uuid/<device_id>

Or you can use udisks.

sudo udisksctl unmount /dev/<device_id>

You can get the device ID using sudo fdisk -l command

To install udisks if not installed, just do

sudo apt-get install udisks

For more info see the udisks manpage

Related Question