Coder Social home page Coder Social logo

avertry / automount-pve Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theyo-tester/automount-pve

0.0 0.0 0.0 36 KB

Simple auto mount script tested on Proxmox 8, that will mount found partitions (ext4/ntfs/fat) on usb attached storages to /mnt/auto/PARTITION_LABEL

Home Page: https://github.com/theyo-tester/automount-pve

License: Apache License 2.0

Shell 100.00%

automount-pve's Introduction

Auto-Mount Memories on Proxmox (8) or any Debian (12) based system

This is a set of auto-mount script & rules tested on Proxmox 8. It will mount every partition (ext4/ntfs/fat) found on dynamically/usb attached memories (sticks, external HDDs, sd-cards...) to /mnt/auto/....

Why?

  • Let's assume, you just want to transfer some files offline to/from a usb attached memory, you would need to execute the same (rather simple) commands every time you attach the disk again. This is annoying!
  • As long as you use the same partition label, you can statically create a directory storage in the pve GUI, and use it as backup location f.i.. As soon the memory containing the partition is attached, it can be used by PVE for backups.
  • I found no final solution for this task (especially for pve 8 on debian 12). Other found solutions are not mantained anymore. I did not even tried them because they were made for pve7
  • That's why I wrote my own solution after some try and fails.

Install

  • Clone/Download this repo to your machine. Go inside the folder.
  • run ./installAutoMount.sh This will copy the needed files to the right folders and reload systemd.
  • Test: Plug in a usb memory and check the /mnt/auto folder for further subdirectories. /mnt/auto will be automatically, created as soon some partition can be mounted there.

Important notes

  • systemd-udev-settle is deprecated and it breaks the whole booting process. Even Networking is stopped at boot after just a simple harmless udev rule is added.
  • This script will override two pve default services (if found), which are unnecessarily using systemd-udev-settle: zfs-import-cache and zfs-import-scan. The small change will take out the dependency for systemd-udev-settle. But there is a catch:
  • !! If this default unit files will change in future updates, these overrides will not be aware of that. I saw no other option to take out the broken dependency. If anyone knows a better option, feel free to suggest! But there is good news also:
  • The install script will only apply the overrides, if a dependency to systemd-udev-settle will be found. If they fix this in the future, the override will not be applied anymore (at install!).
  • !! This automation was only tested on Proxmox 8 with LVM storage (no ZFS). If you are using zfs, use it at your own risk! Any feedback is appreciated. Otherwise, I plan to test this myself in the future.
  • The mount folder name will be the label of the partition, by default. If no label can be determined, the name of the device (e.g sdc2) will be used. If a directory with the same name exists already, thae the folder will get the device name as suffix.

Example: Partition /dev/sdb1 Partition Label: myUsbData ==> Mount will be found at /mnt/auto/myUsbData

  • This automation will NOT create a new storage in PVE. For this you have to go in the pve gui:
    • Datacenter->Storage->Add->Directory
    • Specify any ID you want (I usually specify the partition label here but it doesn't matter)
    • Directory: the automatically created mountpoint, e.g. /mnt/auto/myUsbData[/optionalSubfolder] I suggest you create a special folder on your storage (f.i. "pve") for proxmox related data
    • Content: choose also VZDump if you want to save pve backups on it.
  • The main mount script (mount_usb_memory.sh) was inspired from this article

automount-pve's People

Contributors

theyo-tester avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.