D3 and mvBase

 View Only
  • 1.  Linux and USB drives - fixing the name

    Posted 03-04-2024 12:41

    I have quite a few customers running Rocky Linux as their OS for D3. Every single one of them has the same problem. A reboot of Linux, not a total shutdown, changes the designation of the USB drives that they use for nightly on-site backups. What was /dev/sdb might come up as /dev/sdd on a reboot. Since they are designated in the PICK0 file for FILE-SAVES, this creates a major problem.

    How can I prevent this problem?



    ------------------------------
    Richard Ginsburg
    President
    Ginsburg Consulting
    Manassas VA US
    ------------------------------


  • 2.  RE: Linux and USB drives - fixing the name

    Posted 03-04-2024 13:38

    an quick search in google, thats a "normal" behaviour for ArchLinux
    you have 2 options
    1) use UUID instead the device 
    2) change the UDEV rules by
    SYMLINK+= in your rule; see e.g., /lib/udev/rules.d/60-persistent-storage.rules for examples.

    test before use in production !!



    ------------------------------
    Alberto Leal
    System Analyst
    Millano Distribuidora de Auto Pecas Ltda
    Varzea Grande MT BR
    ------------------------------



  • 3.  RE: Linux and USB drives - fixing the name

    Posted 03-04-2024 18:59

    What is UUID? Can you show me an example, please?



    ------------------------------
    Richard Ginsburg
    President
    Ginsburg Consulting
    Manassas VA US
    ------------------------------



  • 4.  RE: Linux and USB drives - fixing the name

    Posted 03-05-2024 07:06

    ls  -lha /dev/disk/by-uuid
    to see the uuids options

    mount -U 1234-SOME-UUID /some/mount/folder

    to mount the disk using UUID



    ------------------------------
    Alberto Leal
    System Analyst
    Millano Distribuidora de Auto Pecas Ltda
    Varzea Grande MT BR
    ------------------------------



  • 5.  RE: Linux and USB drives - fixing the name

    Posted 03-05-2024 07:23

    $ lsblk  -f

    IMO, you should always mount file systems by UUID exactly for the reasons you are experiencing. e.g. in /etc/fstab, don't mount by device, mount by UUID:

    #/dev/md126    /home    ext4    defaults,nofail,discard    0    2
    #/dev/md127    /opt    ext4    defaults,nofail,discard    0    2

    UUID=474aa4e7-eea8-469b-adf0-8bb56e4242e5 /home    ext4 defaults,nofail,discard 0 2
    UUID=aa46cdd6-14a5-497d-997f-dd5b8e7f823b /opt ext4 defaults,nofail,discard 0 2



    ------------------------------
    Bryan Buchanan

    ------------------------------



  • 6.  RE: Linux and USB drives - fixing the name

    Posted 03-05-2024 16:51

    The disadvantage of a UUID is that it has to be the same USB drive.

    Your procedure would be :

    1. insert USB
    2. do backup
    3. remove USB and copy or move the backup off the USB. alternativly copy the files(s) from the USB & goto step 2.
    4. goto step 1

    I understand that there are ways of setting the UUID for a drive.

    fstab may allow different UUID's for the same mount point.



    ------------------------------
    Warwick Dreher
    Warwick Dreher
    Croydon AU
    ------------------------------



  • 7.  RE: Linux and USB drives - fixing the name

    Posted 03-05-2024 17:29

    If you don't like UUIDs, maybe...

    I assume you have some sort of script to do the backup, which assumes a given disk device.
    If your USB device is mounted on, say, /tmp/usb.disk, so your pick0 entry is

    tape /tmp/usb.disk 500 f lx  # tape 3

    You could do the following:

    1. label all USB disks you're ever going to use

    # e2label /dev/??? "mylabel"

    Note - you only need to know the physical mount point once when you label the disks

    2. run your backup from a shell script which mounts the device in the correct place.
    This needs to run as root or sudo.

    -----
    #!/bin/bash

    umount /tmp/usb.disk
    mount -L mylabel /tmp/usb.disk

    if grep -qs '/tmp/usb.disk' /proc/mounts; then
    #
    #   USB disk is now mounted on a known mount point
    #   run a D3 command to do backup
    #
        d3tcl "some D3 command to run your backup"
    else
    #
    # Oops - some error on mount
    #
        echo "Could not mount external disk !"
    fi
    -----

    Of course, you could label each day's USB something different and change the script to suite.

    Note the d3tcl command requires some environment variables. Check the manual.



    ------------------------------
    Bryan Buchanan
    Manager
    WebbTide Systems Pty Ltd
    Morayfield QLD AU
    ------------------------------