On Thu, Jan 28, 2016 at 01:24:07PM -0700, Chris Murphy wrote: > >> How about something like: > >> > >> # hdparm -Y /dev/sdb > >> # echo 1 /sys/block/sdb/device/delete > >> > >> Then physically disconnect the drive, assuming hot-plug is supported > >> by all hardware? > >> > > That should safely disconnect the device, but you may still have to touch > > some of the PM related stuff in the /sys/class/ directories for the disk > > itself, and possibly do something to force it to flush the write cache > > (toggling the write cache off then back on again usually does this). > > Interesting, I figured a umount should include telling the drive to > flush the write cache; but maybe not, if the drive or connection (i.e. > USB enclosure) doesn't support FUA? > > I wonder what the kernel sends to the device on restart/poweroff? Yes, I did neglect to mention that. Wherever I said eject, I meant "send 1 to /sys delete, wait for drive to spin down, then remove." I also unmount all partitions that are on that disk. It's not an enclosure, it's hot-swap sata ports on the motherboard. --Sean -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
