Skip to content

Newbie questions towards unmount and commands when creating a bootable USB

Hey guys!

(In case you're not interested in reading all this, thing I'd understand, please consider reading my questions at the end)

I didn't know exactly where to write this question, but here's the thing.

I've created USB bootables in a lot of ways. I was more used to creating them through interface programs. The fact is, I always used to have some kind of problem when creating them by console.

Months ago I discovered the Arch wiki, it's been such a blessing to me. I'm learning a lot of topics and thanks to it I find myself improving on Linux.

But here comes what happened. The other day I was looking how to create a bootable disk on the wiki. After reading on a lot of websites, I got to this line.

"Make sure that it is not mounted."

That simple sentence made my mind explode. All these years having issues trying to create a bootable through the console. I've formatted a drive multiple times just to make sure I understood. So I unmount the file system, and then I use some of the commands.

Conclusion: My problems creating a bootable disk are gone.

But I'm a curious person, and I always like to understand everything, so... Here I go!

Questions

  1. Why do we need to unmount the file system in order to write the iso to the drive?

  2. Why does the process usually fail when the file system is mounted?

  3. What is happening exactly when I do something like "cat arch.iso > /dev/sdx"?

  4. And maybe this is a weird question, but why exactly does that work and not "cat arch.iso > /dev/sdx1" is it because the .iso file itself is like doing disk1(iso) > disk2(drive)?

I'm still pretty newbie related some Linux things.

I appreciate your patience just for the fact of reading all this. I look forward to see if I can understand whatever you explain! Thank you!

5 points6 comments
Open on Reddit
About this post
Posted
Archived
Score
5 · 86% up
Kind
Text
ID
vb17kb

Author

6
posts
31
comments
0
media
View profile

6 comments

I'm not an expert on the subject but this is how I imagine it. Anyone else is free to correct me if they are able to go into more technical detail or feel my analogies are incorrect, which I know they aren't perfect but I think they're pretty close and simple to understand.

​

  1. You're not just copying data, you're writing the partition table from the disk image, in order to overwrite partition data, existing partitions cannot be mounted.
  2. I don't know the exact reason but I would imagine it's to prevent data loss and possibly destroying the partition table from writing conflicts. Like if you're trying to paint an entire room black while someone else is trying to paint one wall blue, rather than end up with a black room with one blue wall, you end up with a black room with a garbled black and blue wall since you were both painting it differently at the same time.
  3. Cat reads data from the file and gives it's content as output while the ">" tells cat to push that data output somewhere else, in this case to disk /dev/sdx for example which would be a drive
  4. The image (ISO) is a disk image not a partition image, so targeting a partition won't work. It's like if you wanted to copy the exact contents of a suitcase, with multiple compartments, organized the exact same way, to a new suitcase but rather than using the planned layout, you just try to cram everything and the organizational structure into one compartment rather than the entire suitcase.
5 points

Love your explanations and analogies. I think they are spot-on, even if they gloss over some of the technical details. Only your point 3 addresses question 4.

3 points

Thank you for your kind explanation. I think I finally got it thanks to some of your analogies :)! I don't know if you're an expert or not, but know that you helped someone who's pretty stubborn when it comes to these things :)

2 points

Think of the drive as a big notebook.

Mounting a filesystem would be like attaching a robot to a portion of the pages to use them to store files. Writing an iso file would be equivalent to ripping out every page from the notebook and inserting a new set of pages.

2 points

Thanks for your kind explanation mate, it really helped me :)

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.