Score:1

How to mount a USB disk after partitioning with the fdisk command, as if the USB disk was just inserted and automatically mounted?

cn flag

I have a USB drive disk, whose label is 'DATA'. When I plug in the USB disk, Ubuntu will automatically mount it to /media/cjl/DATA.

I partition it with fdisk command, and I don't want to mount it with 'mount' command. So I unplug the USB drive and plug it in again. Then Ubuntu will automatically mount it to /media/cjl/DATA.

Is there anyway to mount it after fdisk which needn't unplug it?

In other words, how to trigger the plug event without actually plugging in the USB drive?

Raffa avatar
jp flag
Yes, click on its icon in the GUI file manager … Assuming an Ubuntu desktop system.
ar flag
@Raffa this sounds like an answer.
ar flag
You can use the GUI app **Disks** to format (add the label "Data" during format) as well as mount the partition.
tyroc avatar
cn flag
@Raffa Is there any commands to simulate a hotplug event?
hu flag
What is a "hotpul even"? Should I assume there is coldplug as well? Also, what does it have to do with automount? You can use `udisks` to mount partions, but I suspect it just calls `mount` anyway.
Raffa avatar
jp flag
You can mount with udisks by partition name e.g. `udisksctl mount -b /dev/sdb1` ... but, not without specifying a partition name/identifier AFAIK ... [This post](https://askubuntu.com/q/1417539) might help shed some light on this issue ... It's a **bit** complicated :-)
oldfred avatar
cn flag
Why are you using fdisk all the time. It only should be used to initially partition it or make a change. How is system going to know what changes you made unless you do remount it? You also may have changed label from DATA or have newer partitions that you may or may not want to mount.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.