Mount by-label instead of by-id with OMV 5.6.15-1 and btrfs

  • Hi guys,


    installing a new HDD in my 2 years old OMV NAS I also experienced the new situation of new mounting points going to be by-id instead of by-label. I don't want to discuss this in general if it's bad or good, there are enough topics here about this. As I am a creature of habit, I just wanted to have my new drive mounted like all my other old drives. Here is a tutorial how I succeed to to this:


    1. Make sure you have backups of your system and data. This might destroy your OMV config and data. You should know what you will do. I'm not an linux expert, I just figured out how to solve my issues and it worked. Red text needs to be replaced with your custom values like UUID and label. I tried this on 5.6.15-1 (Usul)
    2. Shutdown, insert your new hard drive in your NAS case, boot up again (if not hot swap nas)
    3. Wipe the new drive. Login into your OMV UI --> Storage --> Disks --> select the new drive. Make sure all data on the new drive is not needed any more, because this will completely clean your new drive
    4. Optional: Encrypt the new drive with the label you desire (LUKS encryption). E.g. mylabel2000. Once created, unlock the drive with you just encrypted
    5. Create a new filesystem (I am using btrfs) for your new drive and insert the desired label as well. E.g. mylabel2000. But do not mount the new drive!
    6. Open omv config, e.g.

      nano /etc/openmediavault/config.xml
      Search for "<hdparm>". Watch out for the drive you added, it should be listed in one of the <devicefile> elements. Copy the uuid between <uuid> and </uuid>
    7. Open fstab to add your new drive, e.g.
      nano /etc/fstab
      Insert new line before
      # <<< [openmediavault]
      and insert the following (change the label name mylabel2000 to your defined label):
      /dev/disk/by-label/mylabel2000 /srv/dev-disk-by-label-mylabel2000 btrfs defaults,nofail 0 2
      Save your configuration
    8. Open omv config, e.g.
      nano /etc/openmediavault/config.xml
      Search for <fstab>
      Add new drive directly after <fstab>, e.g. (change YOUR_UUID_OF_NEW_DRIVE and mylabel2000 to your defined label name)
      <mntent> <uuid>YOUR_UUID_OF_NEW_DRIVE</uuid> <fsname>/dev/disk/by-label/mylabel2000</fsname> <dir>/srv/dev-disk-by-label-mylabel2000</dir> <type>btrfs</type> <opts>defaults,nofail</opts> <freq>0</freq> <passno>2</passno> <hidden>0</hidden> </mntent>
    9. Maybe you need to reboot again,I don't remember if I did this or not :)
    10. Once up and running again, decrypt and after some seconds the mounting should happend automatically

    Make sure you have backups and a rollback strategy if something goes wrong!


    Best

    Michael

  • Agricola

    Approved the thread.
  • Thanks for this guide. Using your guide was able, last week, to successfully "mount by label" instead of "mount by uuid" new 4TB internal drive in Btrfs. Works like a champ.

    Debian/KDE, FreeBSD, Debian 13

    OMV8 NAS 2-10GB LACP bond0 Fiber, pfSense+ firewall/router

    • Official Post

    A symlink would've been easier.

    omv 8.1.1-1 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.5 | cterm 8.0 | borgbackup 8.1.7 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Official Post

    A page of explanations and formatting in BTRFS only to mount by label? It does not make any sense...

    • Official Post

    If the vast majority of current distributions (or perhaps all) have chosen to use UUID mounts rather than label mounts, they probably have good reasons for doing so. Don't you think?

  • If the vast majority of current distributions (or perhaps all) have chosen to use UUID mounts rather than label mounts, they probably have good reasons for doing so. Don't you think?

    You are most likely right. The way I understand (good, bad or indifferent) is that a main reason for this are users that use USB drives and just plug and unplug them without bothering of "mount" and "umount". I guess it is a fact of life, but I am old guy and used to the old fashion ways.

    Debian/KDE, FreeBSD, Debian 13

    OMV8 NAS 2-10GB LACP bond0 Fiber, pfSense+ firewall/router

    • Official Post

    I am just not a big fan of user created soft links.

    But hacking the database is ok?

    omv 8.1.1-1 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.5 | cterm 8.0 | borgbackup 8.1.7 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Official Post

    It is not really hacking. Just modifying system cofiguration/sttings.

    Putting a configuration in a database that could never be created by the program is a hack in my book.


    BTW, it is an open source, right?

    Yes. I wasn't saying you can't change what you like. I was just mentioning a symlink might be a better option. There is even a plugin to create it. I'm not sure what open source has to do with it since you can "hack" the Windows registry just as easily.

    omv 8.1.1-1 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.5 | cterm 8.0 | borgbackup 8.1.7 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Putting a configuration in a database that could never be created by the program is a hack in my book.


    Yes. I wasn't saying you can't change what you like. I was just mentioning a symlink might be a better option. There is even a plugin to create it. I'm not sure what open source has to do with it since you can "hack" the Windows registry just as easily.

    I guess you have a misunderstanding of the meaning of term "hacking". You do not "hack" Windows registries, you modify and adjust. You do not "hack" open source (hence term "open") scripts.. So I do not like user created soft links, you do. I have no issue with that. You apparently have a issue with anyone that dares to change/modify and or adjust open source settings.

    Please let`s finish this conversation as it will lead us to nowhere..

    Debian/KDE, FreeBSD, Debian 13

    OMV8 NAS 2-10GB LACP bond0 Fiber, pfSense+ firewall/router

    • Official Post

    You apparently have a issue with anyone that dares to change/modify and or adjust open source settings.

    I only have an issue when I have to support them (I know you probably don't need it) and don't know they have changed the setting. We obviously have a difference in opinions (fine with me) and we can be done.

    omv 8.1.1-1 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.5 | cterm 8.0 | borgbackup 8.1.7 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!