Powering down external hard drive, flash drive, etc using the command line in Linux
/dev/sdb
is the whole device. /dev/sdb1
is one partition on that device.
While you could use a disk without partitioning it, that's rather unusual (outside of RAID setups, but then you make the filesystems on the raid device nodes, not the physical device nodes).
It doesn't really make sense to try to detach (physically remove) a single partition – you want to remove the whole device (that can contain multiple partitions), not just one partition of that device.
Unmounting a partition will synchronize the filesystem, so calling sync
before unmount
is not necessary.
Calling udisks --detach
on the device checks that you have no filesystems mounted on that device (you should make sure that that call does indeed succeed), and will perform an "orderly shutdown", which is always preferable to a "pull the plug" approach, regardless of whether that particular device does anything special.