Symlinks to Removable Media

If it doesn't relate to Debian, but you still want to share it, please do it here

Symlinks to Removable Media

Postby KitchM » 2020-05-21 20:34

What is the preferred method for creating a symlink to a removable USB drive?
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby peter_irich » 2020-05-22 05:39

Through udev rule. Udev-rule must be placed in /etc/udev/rules.d.

Peter.
peter_irich
 
Posts: 1287
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-22 14:43

What would be the appropriate format? How does one identify a removable device to be recognized by next insertion? Does one use device or partition name?
Last edited by KitchM on 2020-05-22 15:15, edited 1 time in total.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby arzgi » 2020-05-22 14:51

KitchM wrote:What would be the appropriate format? How does one identify a removable device to be recognized by next insertion? Does on use device or partition name?


http://reactivated.net/writing_udev_rules.html
arzgi
 
Posts: 638
Joined: 2008-02-21 17:03
Location: Finland

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-22 16:21

Thank you for that link. I will read it and see if I can figure out how to make it apply in my particular situation.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Dai_trying » 2020-05-22 19:39

I found
Code: Select all
udevadm monitor
really useful when writing udev rules.
Dai_trying
 
Posts: 928
Joined: 2016-01-07 12:25

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-22 20:04

Thanks. I'll give that a look. Maybe I can figure out how it will help me.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby cuckooflew » 2020-05-22 22:15

KitchM wrote:Thank you for that link. I will read it and see if I can figure out how to make it apply in my particular situation.

Probably if you gave better details and explained exactly what your particular situation is, you might get more specific instruction,... :D
by KitchM » 2020-05-22 20:04
Thanks. I'll give that a look. Maybe I can figure out how it will help me.

The document that is linked to seems pretty detailed, and straight forward, I see where it answers this:
How does one identify a removable device to be recognized by next insertion?

Have you gotten that far ? Can you now identify the device ?
My question is why you feel you need to make symlinks to removable media, and use udev , I have never needed it myself, in my particular situation,..which does include making bootable usb drives, and storage drives, also usb devices such as printers, optical drives, maybe if I understood why you need to use udev and what the "usb drive" is , eg : a bootable drive, perhaps with a "live" Debian, etc...
Does one use device or partition name?

Err, I do not understand, you would need to use the device, but if a particular partition on a certain device was what you want to make a symlink to , I think you would need to include that,.. this is something that would be easier to answer clearly if we knew more about what exactly you are doing or want to accomplish.
In my situation, I need to use the device name, and include the specific partition I want to mount, but I do not need or use "udev" or any symlinks to do this. But if I did need to create symlinks, I would say. the best way to do this is with the 'ln ' terminal command , and now we seethe problem with asking "what is the prefered method, to do something", you may get various opinions on what the best way is, just because "udev" was the first response, does not mean others prefer or use it. It would be better if you just decide, what method you want to use, and then ask for detailed instruction, if you need it. I am not going to go any further with using the 'ln' command, since you all ready have started asking for details on udev. I guess for now that is all. Ahh, there is plenty of tutorials, on both "udev" and the "ln" command
methods, there also are a few graphical file managers that can create symbolic links too, something I did not know until just now.
Please Read What we expect you have already Done
Google knows a lot,
God, our Father knows all, maybe ask Him ,
…one flew east, one flew west,
One flew over the cuckoo’s nest.

I am not the right colour, so my life does not matter ?
to God it does :)
cuckooflew
 
Posts: 434
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-26 17:24

Much thanks for the info; all good.

I will say that the way we all think is different and assumptions get in the way. For instance, I read thru the document and found it has a lot of good detail, but it leaves out a lot as well. In point of fact, I have written the author with three messages full of tweaks which need to be made.

Here are a couple. First, there appears to be a difference in the way different media is handled. In other words, one size does not fit all. The examples are fairly good, but fail to give details about USB flash drives; the very thing I wanted to focus upon, and quite ubiquitis today.. Second, there is little information about how to identify an inserted device so as to apply that “label” to the ln command.

I am wanting the information so as to add to my general knowledge of Linux. As such, learning all the basic stuff is necessary.

However, I do have an ulterior motive. I have need of getting a USB flash drive to be recognized by TailsOS while it is running from another USB port. As you know, Tails is based upon Debian; the same Debian I use on my daily and test systems.

In particular, I want to use the Wasabi Wallet with Tails. It installs in, or is extracted to, WasabiLinux-1.1.11.1. It will run from that directory wherever it is found. But upon first run, it creates .walletwasabi in the home directory.

While this all sounds well and good, when Tails is shut down, everything is wiped clean. This is good since one does not want to leave personal information around when desiring to remain anonymous. The user can simply throw the OS drive away if desired.

Tails offers a way to create a hidden and encrypted folder they call a Persistent Storage. However, to access it, one must stop and enter a password every time. Then one must navigate to the program’s directory to run it. Just that bit is a PITA and unacceptable time-wise.

That leaves a separate USB disk. And so the need for a simply symlink to get the two directories recognized and start the program, if the disk is inserted. (Encryption is a side issue. The same ability to throw it away is needed, as well as taking the drive to another computer.)


I’ll bet you didn’t expect you’d be stepping into this mess when you asked, did you? :lol:
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Head_on_a_Stick » 2020-05-26 18:04

KitchM wrote:how to identify an inserted device so as to apply that “label” to the ln command

Dai_trying already told you how to do that. I thought you read all of the replies in your threads?

EDIT: and Tails isn't supported here.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-26 18:08

No, actually he didn't.

Also, this has nothing to do with Tails, as I clearly implied. And since Tails is based upon Debian, any solution should work just fine. That is, unless you know of any specific reason why it would not. Do you?
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Head_on_a_Stick » 2020-05-26 18:13

KitchM wrote:No, actually he didn't.

Yes, they did. The command they posted is the best way to find out how to identify devices for use in udev rules.

And why do you assume that Dai_trying identifies as male?

KitchM wrote:Also, this has nothing to do with Tails, as I clearly implied.

Not sure about "clearly", your posts are too prolix. Please endeavour to be more concise, it will help you get better replies.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Symlinks to Removable Media

Postby cuckooflew » 2020-05-26 22:04

Dai_trying wrote:I found
Code: Select all
udevadm monitor
really useful when writing udev rules.

I decided to do some searches on this, since I don't really know much, as mentioned earlier, found several links that seem to be educational, :
https://www.tecmint.com/udev-for-device-detection-management-in-linux/
To find the name assigned to your USB disk, use the lsblk utility which reads the sysfs filesystem and udev db to gather information about processed devices.

But the above also gives some details about udevadm monitor as well.
===================
https://sites.google.com/site/itmyshare/system-admin-tips-and-tools/udevadm---useage-examples
============================================================
https://linux.die.net/man/8/udevadm
======================
This below also , mentions all of the above methods :
https://unix.stackexchange.com/questions/14165/list-partition-labels-from-the-command-line
======
Summary
Second, there is little information about how to identify an inserted device so as to apply that “label” to the ln command.

I am wanting the information so as to add to my general knowledge of Linux. As such, learning all the basic stuff is necessary.

The four links posted will definitely help add to your general knowledge, and should keep you busy for a while.
My suggestion is to try the various commands and options, then decide what is the best way for your particular situation, (Did I all ready say that ?, I think I did, sorry)

However, I do have an ulterior motive. I have need of getting a USB flash drive to be recognized by TailsOS while it is running from another USB port. As you know, Tails is based upon Debian; the same Debian I use on my daily and test systems.

Really don't know here, I have never used Tails, so no I did not know it is based on Debian, it does seem like the same commands could be applied, but maybe not, however the commands are standard Linux commands and tools, so go figure, suppose you just need to try them.
Please Read What we expect you have already Done
Google knows a lot,
God, our Father knows all, maybe ask Him ,
…one flew east, one flew west,
One flew over the cuckoo’s nest.

I am not the right colour, so my life does not matter ?
to God it does :)
cuckooflew
 
Posts: 434
Joined: 2018-05-10 19:34
Location: Some where out west

Re: Symlinks to Removable Media

Postby KitchM » 2020-05-27 18:10

@ Head_on_a_Stick,
Yes, they did. The command they posted is the best way to find out how to identify devices for use in udev rules.

It would have been nice if the individual had stated what it is, what it does, how to use it and what to expect as output. So the suggestion remains incomplete.

Here’s what I got in my terminal:

~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

and then nothing.

And no way to get out of it either.

And why do you assume that Dai_trying identifies as male?

No assumption made or intended. It is the default of the English language for literally hundreds of years.

Not sure about "clearly", your posts are too prolix. Please endeavour to be more concise, it will help you get better replies.


That’s humorous. First, I’m not being clear enough, then I’m being too wordy.

Why did you think that your objections had anything to do with the basis of this thread?

@cuckooflew,
Thanks, as always. Very interesting stuff. (I didn’t know about the Hotplug relationship.)

You found some good ones; sometimes it just takes the right phraseology in the search.

You are quite correct; should take me a while to digest all that. Looking forward to it. Thanks again.
KitchM
 
Posts: 98
Joined: 2019-06-11 18:11

Re: Symlinks to Removable Media

Postby Head_on_a_Stick » 2020-05-27 18:43

KitchM wrote:It would have been nice if the individual had stated what it is, what it does, how to use it and what to expect as output

That's what man pages are for...

KitchM wrote:Here’s what I got in my terminal:
Code: Select all
~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

and then nothing.

Hint: plug a device in ;)

And please use code tags when posting terminal output, as I have done above. It greatly aids readability, especially for longer listings.

KitchM wrote:And no way to get out of it either.

<ctrl>-c exits most things in a terminal.

KitchM wrote:
And why do you assume that Dai_trying identifies as male?

No assumption made or intended. It is the default of the English language for literally hundreds of years.

How very woke of you :roll:

KitchM wrote:First, I’m not being clear enough, then I’m being too wordy.

Yes indeed, balance is the key. Thank you for understanding.

KitchM wrote:Why did you think that your objections had anything to do with the basis of this thread?

Why do you think I care?
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12194
Joined: 2014-06-01 17:46
Location: /dev/chair

Next

Return to Offtopic

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable