title: Linux (Ubuntu): safely remove a USB flash disk via the command line
body: <p>It would just be cool if your shell script helps you to <strong>safely remove your flash disk</strong> after finishing its job. The solution is expected to meet the following needs:</p>
  <ol>
  <li>Suppose the flash disk is mounted as <code>/media/A</code> together with many other flash disks and the code can selectively just remove <code>/media/A</code> without interfering other disks. For example, I can pass <code>/media/A</code> as an argument.</li>
  <li>A light solution. Installing another package of size 100MB to finish the task drives one crazy.</li>
  <li>I know some commands like <code>hdparm</code> except their documents are hard to read. If one can offer me a solution I hope he/she can offer also the explanation of the parameters, etc.</li>
  <li>Best if the code can handle all kinds of flash disks (for example, my old one bought in 2003 with 32 MB) (and portable disks optionally).</li>
  <li>It should achieve the exact effect as right clicking the disk → clicking &quot;safely Remove Drive&quot;. The safety concern will prevail, otherwise one may just unplug the disk which usually won't hurt.</li>
  </ol>