GithubHelp home page GithubHelp logo

stertingen / udev-media-automount Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ferk/udev-media-automount

0.0 0.0 0.0 27 KB

A simple automount mechanism using udev rules

License: Other

Shell 90.52% Makefile 9.48%

udev-media-automount's Introduction

udev-media-automount

Auto mount removable media devices by means of udev rules.

This is intended for simple systems that don't want or can't run the udisks2 daemon (which is designed for GNOME/KDE desktop environments and at the time of this writting is frustrating to set up from a bare commandline).

This combines the previous udev rules I was using in my xdg_config repository with some structure and ideas taken from tylorchu's usb-automount.

Every device that is inserted and isn't already configured in /etc/fstab will be mounted by media-automount. This includes not only usb devices but also card readers and other media with a /dev/sd* device.

If there are devices you don't want to automount neither at boot nor with media-automount, you can add them in /etc/fstab with the option 'noauto'.

The mount options might differ to the filesystem type for the device plugged in. E.g. vFAT and NTFS devices will be mounted with the "flush" option to try to prevent damage on accidental removals of the device with unclean umounts. Also whenever ntfs-3g is available, it will be used to mount ntfs devices.

The mount directory will appear in /media/ under a name with pattern: <LABEL OF THE FS>.<FS TYPE> (if duplicate, _<NUMBER> will be appended).

Due to changes in udev (long running processes are killed), it's necessary to use systemd for spawning a mounting service.

To check the logs produced by the script, run journalctl -t media-automount, add -b for current boot.

Installation

For Archlinux, the udev-media-automount AUR package is offered.

For other systems, you may download the content of the repository from https://github.com/Ferk/udev-media-automount/archive/refs/heads/master.zip

You can then install it using the following instructions

unzip master.zip
cd udev-media-automount-master
sudo make install
sudo udevadm control --reload-rules
sudo udevadm trigger

Configuration

The folder /etc/media-automount.d can be used to set custom mount options for specific device types.

If a file with filename matching a filesystem type (eg. vfat, nfts, etc) is found, it'll be loaded when a device using the given filesystem is to be mounted. This can be used to change the parameters provided to mount.

An example below for /etc/media-automount.d/ntfs:

# Mount options to use for auto-mounting NTFS drives
AUTOMOUNT_OPTS='errors=remount-ro,relatime,utf8,user,flush'

# Always use NTFS-3G to automount NTFS filesystems
AUTOMOUNT_TYPE="ntfs-3g"

Note that these files are sourced as shell scripts, so it's possible to include logic in them in case you want to conditionally apply some configuration.

udev-media-automount's People

Contributors

ferk avatar taylorchu avatar lafleurdeboum avatar stertingen 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.