What would be a proper way to shutdown a sata disk connect with a usb interface ?

What would be a proper way to shutdown a sata disk connect with a usb interface ?

shimi linux-il at shimi.net
Sun Dec 16 10:13:17 IST 2018


On Sun, Dec 16, 2018 at 9:53 AM <borissh1983 at gmail.com> wrote:

> I'm using sata to usb interface to extract data and to work with end user
> hard
> drives connected to  a laptop.
>
> I'm using that for a periodic offline backups to HDD and an SSD (I know
> unreliable but that is the best I have for now).
>
> What I do today when I need to shutdown it are the next steps :
>
> unmount everything
> sync
>

umount (assuming -l is not used), by definition, cleanly un-mounts the
filesystem - it makes sure all pending writes are written and all metadata
is cleanly committed, then completes. This makes 'sync' unnecessary - the
filesystem would not be considered unmounted before all blocks were already
reported written by the disk. So your 'sync', IMHO, does nothing. I assume
it returns immediately (assuming no dirty data exists on other fs's...).
You would see the umount waiting the way you would expect sync to wait (if
you reversed the order...)

see also
https://unix.stackexchange.com/questions/345917/does-umount-calls-sync-to-complete-any-pending-writes

sdpram -S 30  /dev/sdX (I'm not sure if does anything honestly)
> Wait for ~20 minutes
> physically touch the disk if I feel any movement , if not unplug the power
> the
> usb cord and then unplug the power plug.
>
>
To what end? Why do you believe this is different from a normal shutdown of
your computer with your internal HDDs where the filesystems get unmounted
(the rootfs being re-mounted read-only) and then power off of the ATX power
supply?

I have both SSD and plain old HDDs plugged this way.
>
> I'm feeling that I'm working in an unsafe manner, does any of you have a
> better suggestion how to shutdown the devices correctly to prolong the
> disk
> life ?
>

What is unsafe in your opinion? Can you please elaborate? How does it
relate to prolonging disk life? Clean unmount is (so I believe...) for
filesystem integrity more than anything else...

-- Shimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20181216/81fc1acc/attachment.html>


More information about the Linux-il mailing list