I inserted a USB stick on my laptop and it automount the partition. I then did a umount /dev/sdb* to allow me to DD an image to it. Once DD is done, I do sync then physically unplug the USB then plug it back to get the 2 partitions mounted.

my question is how can I avoid to physically unplug the USB and plug it back again?

| improve this question | | | | |


You can unmount all partitions without trying to unmount the device itself with

sudo umount /dev/sdx?*

Replace the device letter x with the relevant device letter, for example b


It is a good idea to use a cloning tool with a final checkpoint,

Accidentally did dd /dev/sda

Scroll down to 'Safer tools to create USB boot drives with Ubuntu'

Sync, Partprobe, Mount

sudo partprobe

Try mounting after creating the new system on the USB stick

This command line should work with one or more partitions,

for i in $(lsblk -l -o name|grep -E "sdx.{1,}");do sudo mkdir -p /media/$USER/"$i";sudo mount /dev/"$i" /media/$USER/"$i";done

Replace the device letter x with the relevant device letter, for example b

| improve this answer | | | | |
  • what's the advantage to do sudo umount /dev/sdx?* versus sudo umount /dev/sdx* – Louis-Philippe Descamps Apr 9 '18 at 17:47
  • disk cloning, I prefer to keep my system simple. dd is already installed but thanks for the heads up – Louis-Philippe Descamps Apr 9 '18 at 18:16
  • big thanks for the command to re mount the drive works perfectly! – Louis-Philippe Descamps Apr 9 '18 at 18:18
  • @Louis-PhilippeDescamps, I'm glad it works for you :-) The advantage with ?* is that the system does not try (and fail) to unmount the drive itself (/dev/sdx), but only tries to unmount the partitions /dev/sdx1, /dev/sdx2, ... The questionmark makes it look for one wild card character and the asterisk makes it look for any number of characters (zero or more). – sudodus Apr 9 '18 at 18:36

If remember correctly you need to run one command after sync:

sudo partprobe

From its man-page:

partprobe - inform the OS of partition table changes

partprobe is a program that informs the operating system kernel of par- tition table changes.

| improve this answer | | | | |
  • +1. I am using partprobe in some of my scripts for mkusb, and it does its job well with USB sticks. But I think you still have to unplug memory cards. – sudodus Apr 8 '18 at 12:33
  • i tried but didnt work i did lsblk and i can see the mount points sudo umount /dev/sdb* lsblk and i can NOT see the mount points sudo partprobe lsblk and i can still NOT see the mount points – Louis-Philippe Descamps Apr 8 '18 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.