How to bind usb boot stick device to a static name?[SOLVED]

Booting, installing, newbie
Post Reply
Message
Author
User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

How to bind usb boot stick device to a static name?[SOLVED]

#1 Post by perdido »

I have a usb stick that I would like to assign a static name to in order to keep symlinks working. The usb stick is the boot device. There is no savefile or save folder.

Example: I boot my usb stick and it is assigning itself as sdb when booting, I boot again and it assigns itself as sdc which breaks some symlinks.

That is killing my symlinks between partitions on the usb drive (sdb1, sdb2, sdb3) when it is identified as sdc. I would like to force the name to remain constant, either sdb or sdc is fine.
This usb stick is used in multiple computers and has the same issue on all computers.

The OS is upupbb32 19.03 booting from a usb port, same port identifies the usb boot stick as both sdb and sdc, seems to be random. The first two partitions on the usb stick (sdb1, sdb2)
are read only, sdb3 is used for data by symlinking - it breaks my email program when the usb stick has the wrong name, I have to reboot until it gets it right (like the movie groundhog day) :)

.
Last edited by perdido on Fri 25 Oct 2019, 08:22, edited 1 time in total.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#2 Post by Mike Walsh »

@ perdido:-

No guarantees this'll do what you want, but have a look here:-

http://www.murga-linux.com/puppy/viewtopic.php?t=112558

.....jafadmin's guide to setting permanent 'mount-points' using 'udev-rules'.

I have an external, 3TB USB 3.0 Seagate HDD with most of my personal data on it - permanently plugged in - yet I was always getting the same problem you've just described; broken sym-links, through Puppy arbitrarily re-assigning mount-points, seemingly on a whim.

This worked for me, and can even be applied to the same USB drive you set it up on. Let us know if it does what you want. By rights, it should. I now have a permanent mount-point in '/':-

[Click to enlarge:-]


Image


This is Slacko 560's '/', just for a demo......every Puppy in the kennels is the same. Note the permanent 'SeaDesk' mnt-point; sym-links are now set from here, and always remain 'fixed'.

It's extremely simple, yet very robust.....and has never let me down since being implemented.


Mike. :wink:
Last edited by Mike Walsh on Wed 23 Oct 2019, 21:56, edited 2 times in total.

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

Re: How to bind usb boot device (usb stick) to a static name?

#3 Post by rufwoof »

perdido wrote:I have a usb stick that I would like to assign a static name to in order to keep symlinks working.
Set your usb to have a label using gparted or whatever and use /dev/disk/by-label to mount (or whatever) it instead.

If your usb has been set with a label of 'myredusb' for instance then you might
mkdir /mnt/myredusb
mount /dev/disk/by-label/myredusb /mnt/myredusb

..

and later umount it with umount /dev/disk/by-label/myredusb

Puppy wont however show it as myredusb on the desktop (drive icons at the bottom left of screen assuming you use the standard/default desktop layout), but instead will show it as sdc1 ... or whatever.

Alternatively you might use uuid (/dev/disk/by-uuid/...) where running blkid shows the uuid, but uuid can change, such as if you reformat the usb, so label is generally the easier choice. There are other choices as well (as per /dev/disk folder content) but they're more awkward in the general everyday use sense.

Providing you always mount it to the same mount point (/mnt/myredusb), then any sym links you create using that will remain valid.

cd /root
ln -s /mnt/myredusb/somefile.txt somefile.txt
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

#4 Post by perdido »

@Mike Walsh @rufwoof

Thanks for the references and information.
Will be reporting back tomorrow sometime as to how it all went.

Thanks !

.

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#5 Post by jafadmin »

I'm following this thread in case you have questions :idea:

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

#6 Post by perdido »

First I would like to thank everyone for their interest in helping me, the issue is solved but I am not done testing all the methods presented.

Initially tried the udev-mount method mentioned by Mike Walsh that uses the tools created by forum member jafadmin, that works excellent as a consistent mount point for the sym-links.
Its a nice simple set of tools that is easy to set up.

I have not forgotten about your method rufwoof, I will be migrating my testing to your method and will report back later today or tomorrow depending on my schedule.

Then after I report back on rufwoof's method I will test the new set of tools jafadmin has posted (thanks!)

For the first try I used the tools from the udev-mount.tar.gz archive - they seem no longer available on the page since yesterday, having been replaced by the udev-wizard.tar.gz archive??
jafadmin, please correct me if my last sentence is incorrect or if you don't want me linking to the old archive, without the old archive available for reference the folowing steps will not make much sense :)

1. Boot a clean OS (upupbb-19.03 in my case)
2. Create a /root/bin directory.
3. Copy the mkrule script to /root/bin and make it executeable
4. Copy the mnt-MyUSB script to /root/bin and make it executeable
5. Copy the trigger-udev script to /root/startup and make it executable
6. Plug in the drive that I wish to have the static name associated with, it will get static names for all partitions on the drive. In my case it is a usb stick that I will be booting from.
7. Open terminal window in /root/bin and run ./mkrule /dev/sdb
8. After running the mkrule script all my partitions on the usb stick were mounted at /MyUSB/ as MyUSB-1. MyUSB-2, MyUSB-3 (actually are sdb1, sdb2, sdb3 as far as drives listed on the desktop)
9. Created some symlinks to test, they are shown as linking to the drive names MyUSB-1, MyUSB-2, MyUSB-3
10. :D
----------------
---Here is some boring stuff in case you are wondering what I am up to---

Some specifics in what I am using this on, it is on an install of puppy_upupbb_19.03 that is remastered and copied to usb using the install tools in Applications-->Setup-->Puppy Installer
I chose the BootFlash USB Installer that is described as "Install to flash drive - destructive method" & the next choice after that Write ISO file to USB flash drive - that has a paragraph of explanation under it.
It is referred to as destructive method due to needing the space of the whole flash drive to copy the .iso in the same basic manner as a CD disk, "closing" the flash drive to future writes.

The great thing about this type of install is that it makes the puppy OS bulletproof. The other great thing is the installer will then repartition the unused space on the usb drive into a writeable
data partition separate from the OS allowing you to symlink to it from the bulletproof OS install. You can take various measures to further harden the newly created data partition that
I am not going to go into here.

I did the steps outlined in steps 1 - 10 above and then applied them to the extracted puppy_upupbb_19.03.sfs that I am using to build the remaster with. What I changed was:
1. Added the /root/bin/ directory with the two files (mkrule & mnt-MyUSB) mentioned in the install steps above
2. Added the file trigger-udev to /root/startup/ as mentioned in the install steps above.
3. Added the file 70-MyUSB.rules to /etc/udev/rules.d/ - the file 70-MyUSB.rules is generated after running the mkrule script mentioned in step 7 above.

Additionally if you do use the udev-mount tools with a remaster, the tools uniquely identify the usb stick by manufacturer, product, & serial number that makes the file 70-MyUSB.rules usb-device specific.
If you were to install the remastered .iso to a different usb stick other than the usb stick the tools were used on to create the 70-MyUSB.rules file, the identifying information listed in the file 70-MyUSB.rules
would need to be changed to the identifying information of the usb stick it is being installed to. The easy way to change that information is re-run the tools using the new usb stick and copy
the newly generated 70-MyUSB.rules file to /etc/udev/rules.d/ and then remaster the .iso for the usb stick you are installing to. That is only a FYI in case you go there.

After applying those changes I resquashed (mksquashfs -comp xz) the extracted .sfs and copied the newly created .sfs into the puppy remaster build directory /puppylivecdbuild/ that
I am using for modifications of the OS

After that it was as simple as building the remastered CD using the Applications-->Setup-->Remaster Puppy Live-CD choice and telling it to use the drive/partition where the /puppylivecdbuild/ directory is located.
The program asks if you want to make any changes, etc., all my changes are done so we just build the CD and install it to usb using the install procedure mentioned above.

Once again thanks to you all (Mike Walsh, rufwoof, jafadmin) rest assured I will be reviewing the other methods presented and reporting back :)

.

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

Re: How to bind usb boot device (usb stick) to a static name?

#7 Post by perdido »

rufwoof wrote:
perdido wrote:I have a usb stick that I would like to assign a static name to in order to keep symlinks working.
Set your usb to have a label using gparted or whatever and use /dev/disk/by-label to mount (or whatever) it instead.

If your usb has been set with a label of 'myredusb' for instance then you might
mkdir /mnt/myredusb
mount /dev/disk/by-label/myredusb /mnt/myredusb
Following up after trying this method suggested by rufwoof.
This method did not work for me. I did the following in my attempts.

1. The usb stick label is puppy_upupbb_19.03-abcd , that is derived from the .iso, it is also the label from the CD (I added -abcd to CD volume label befor building the remaster)
That label shows in GParted when looking at the usb stick after writing (dd) the puppy_upupbb_19.03-abcd .iso to the usb stick.

2. Made the directory /mnt/puppy_upupbb_19.03-abcd

3. Open terminal and run mount /dev/disk/by-label/puppy_upupbb_19.03-abcd /mnt/puppy_upupbb_19.03-abcd

4. get the following error

Code: Select all

mount-FULL: /mnt/puppy_upupbb_19.03-abcd: special device /dev/disk/by-label/puppy_upupbb_19.03-abcd does not exist.
I appreciate your interest in my issue & thanks for the suggestion, it may be my ineptitude with linux that caused the fail. :?
I may have misunderstood the instructions or missed something implied.

Onward to try another method using the udev-wizard tools referenced earlier in this thread. :)

.

User avatar
perdido
Posts: 1528
Joined: Mon 09 Dec 2013, 16:29
Location: ¿Altair IV , Just north of Eeyore Junction.?

#8 Post by perdido »

This post is about using the udev-wizard.tar.gz tools located at http://www.murga-linux.com/puppy/viewto ... 668#980668
They are a set of scripts that get put in various places in /root/ similar to the udev-archive.tar.gz scripts I wrote about earlier.

These are a refined version of the tools (scripts) I wrote about two-posts above this post.
They are provided by forum member jafadmin and are excellent for what I needed to do as explained in the original post to this thread.

There is really nothing I can add to what is in the other post, these tools are easy to use and include a nice readme.txt that explains how to use. Painless, easy, and functional. :)

Thanks for the nice tools jafadmin!

.

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#9 Post by jafadmin »

perdido wrote: Thanks for the nice tools jafadmin!

.
You betcha! :)

Post Reply