I had just finished setting up Dual Boot on My Linux PC(Ubuntu 22.04) in order to access Windows Software - Staad Pro( I have a low-end PC so this was the best option).
Boom, I formatted the drive and well, now it's nowhere to be found.
With no idea what to do, I headed to Google and scoured ultimately leading me to this article.
Now, surprisingly my solution lay in many different Pages - Ubuntu, Stackoverflow.
My goal here is to share what worked for me and how the problem was eventually solved for me. Here goes;
Solution Steps:
- Formatting the Drive:
We need to create a new file system on the drive. Open a terminal and run:
mkfs.ext4 /dev/sdXY
Remember to replace XY
with the correct partition identifier, like sda2
or sdb1
. Double-check to avoid formatting the wrong drive!
Note: To find your partition identifier
. Use this command sudo fdisk -l
. This is how it looked on my end. It was the last Disk that appeared. The name of mine is /dev/sdb
.
- Creating a Mount Point:
Now, let's tell Ubuntu where to access the drive after formatting. Create a directory for it:
sudo mkdir -p /media/usbstick
This creates a mount point called "usbstick" under the /media
directory.
- Mounting the Drive:
Time to connect the drive to Ubuntu! Execute this command:
sudo mount -t ext4 /dev/sdXY /media/usbstick
Again, replace XY
with your partition identifier. This command mounts the drive to the /media/usbstick
folder, making it accessible in your file manager.
- Permissions (Optional):
If you encounter ownership issues when copying files, you can grant everyone write access:
sudo chown nico:nico /media/usbstick
- AutoMount
Apparently, despite all the above, I had to be the root user to unmount. I hated this so much, so I found that by adding this to the file /etc/fstab
. The problem was solved
/dev/sdXY /media/usbstick auto user,nofail,x-gvfs-show 0 0
Again, replace XY
with your partition identifier.
And somehow, after 3 hours of searching, it all came down to these four, five lines of code.
But this was not to be the end. All of a sudden, It required root access to Copy anything to the drive,even though I had already prepared for this with step 4. I wasn't to be discouraged though.
You might say this was a waste of time, but I believed finding the best solutions to this problem would save the time of me or anyone else in the future and this is why I battled on for another 3 hours formatting the drive several times along the way, despite the risks and ultimately discovering that it was all but a little bug from the nautilus app that caused these issues
Final Fix
The fix turns out to be a simple restart of Nautilus or a total restart of my PC after un-mounting and unplugging the drive. Once I did that. Everything was fixed. This was after the initial changes mentioned in this article were applied.
References
Contact
If the above still doesn't work for you or you have any questions. Pls do not hesitate to reach out to me via the comments or on Twitter