Is there a command to unplug correctly a usb hdd? - Hardware

This is a discussion on Is there a command to unplug correctly a usb hdd? - Hardware ; "=SERGE=" (serge_mtu@mtu-net.ru) writes: > tha's the question > > are there any necessary actions to take to disconnect a usb HDD or it is > ennough just to turn it down? > > thank you > > I would think ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Is there a command to unplug correctly a usb hdd?

  1. Re: Is there a command to unplug correctly a usb hdd?

    "=SERGE=" (serge_mtu@mtu-net.ru) writes:
    > tha's the question
    >
    > are there any necessary actions to take to disconnect a usb HDD or it is
    > ennough just to turn it down?
    >
    > thank you
    >
    >

    I would think you'd want to umount it before doing anything. Otherwise,
    you can't be sure that the information "written" to the drive has
    actually been written to it, or if it's merely waiting in a buffer or
    cache. That's no different from removing a floppy or USB flash drive
    without umounting it.

    That's the key point, I can't imagine other things being needed.

    Michael


  2. Is there a command to unplug correctly a usb hdd?

    tha's the question

    are there any necessary actions to take to disconnect a usb HDD or it is
    ennough just to turn it down?

    thank you



  3. Re: Is there a command to unplug correctly a usb hdd?

    Michael Black staggered into the Black Sun and said:
    > "=SERGE=" (serge_mtu@mtu-net.ru) writes:
    >> Are there any necessary actions to take to disconnect a usb HDD, or it
    >> is [it enough] just to turn it down?


    Turn it down? ("*My* USB disk goes to 11!")

    > I would think you'd want to umount it before doing anything.
    > Otherwise, you can't be sure that the information "written" to the
    > drive has actually been written to it, or if it's merely waiting in a
    > buffer or cache. That's the key point, I can't imagine other things
    > being needed.


    This is true. However, some USB disks display different/odd behavior.
    The iPod I have displays a "Do not disconnect" on its LCD when it's
    plugged into a USB2 port. It does this regardless of whether it's been
    mounted or not. ISTR the workaround for this was to rmmod ehci-hcd
    (really) but all this does is replace "do not disconnect" with the
    default menu. Data integrity is not affected, AFAICT, by unplugging the
    iPod after "umount /mnt/ipod" has returned successfully.

    --
    This is my rifle, this is my GNU
    This is for fighting, this is for $FOO!
    --AJS in ASR
    Matt G|There is no Darkness in Eternity/But only Light too dim for us to see

  4. Re: Is there a command to unplug correctly a usb hdd?

    Dances With Crows wrote:
    > Michael Black staggered into the Black Sun and said:


    >> I would think you'd want to umount it before doing anything.
    >> Otherwise, you can't be sure that the information "written" to the
    >> drive has actually been written to it, or if it's merely waiting in a
    >> buffer or cache. That's the key point, I can't imagine other things
    >> being needed.

    >
    > This is true. However, some USB disks display different/odd behavior.
    > The iPod I have displays a "Do not disconnect" on its LCD when it's
    > plugged into a USB2 port. It does this regardless of whether it's been
    > mounted or not.


    Yes, that's a bit of a pity, and it's the same for USB flash drives.

    But remember that you can write to a USB disk without mounting it,
    just as you can write to a "normal" disk without mounting it (e.g. using
    fdisk, or just "cat usbstick.img >/dev/usbstick"). So the system cannot
    easily determine when it should signal the "it's now safe to unplug".

    > ISTR the workaround for this was to rmmod ehci-hcd
    > (really) but all this does is replace "do not disconnect" with the
    > default menu. Data integrity is not affected, AFAICT, by unplugging the
    > iPod after "umount /mnt/ipod" has returned successfully.


    Of course "rmmod ehci-hcd" doesn't help if you have more than one USB
    2.0 device plugged in.

    As you said, it's safe to unplug the device after umounting it - or if
    you just used "cat usbstick.img >/dev/usbstick", do a "sync" afterwards.

    Regards...
    Michael

  5. Re: Is there a command to unplug correctly a usb hdd?

    et472@FreeNet.Carleton.CA (Michael Black) said:
    >"=SERGE=" (serge_mtu@mtu-net.ru) writes:
    >> are there any necessary actions to take to disconnect a usb HDD or it is
    >> ennough just to turn it down?
    >>

    >I would think you'd want to umount it before doing anything. Otherwise,
    >you can't be sure that the information "written" to the drive has
    >actually been written to it, or if it's merely waiting in a buffer or
    >cache. That's no different from removing a floppy or USB flash drive
    >without umounting it.


    Note that since Linux 2.6.19, the kernel has supported a "flush" mount
    option, which addresses exactly this case. It'll ensure that data is
    written to disk when a close() for a file completes.

    At least on the machines I could test right now, removable r/w media
    gets automatically mounted with the 'flush' option - making it safe
    to remove the media whenever you know that no application has a file
    open.
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)

  6. Re: Is there a command to unplug correctly a usb hdd?

    =SERGE= wrote:

    > tha's the question
    >
    > are there any necessary actions to take to disconnect a usb HDD or it is
    > ennough just to turn it down?
    >

    Depends upon how it got mounted in the first place. You may look
    at /etc/mtab ... if you see a "sync" on the line for your device, it's slow
    but safe to unplug once there is no application/filemanager open with that
    device in view, or no shell window sitting in a directory on the device. To
    make sure, run lsof|grep your_device.
    Unmounting cannot hurt too, but it probably needs su.

    --
    vista policy violation: Microsoft optical mouse found penguin patterns
    on mousepad. Partition scan in progress to remove offending
    incompatible products. Reactivate MS software.
    Linux 2.6.17mm,Xorg7.2/nvidia [LinuxCounter#295241,ICQ#4918962]

+ Reply to Thread