{"id":28311811,"url":"https://github.com/mishrahrishikesh/pmount-custom-linux-cmd","last_synced_at":"2026-05-17T19:07:23.533Z","repository":{"id":294021095,"uuid":"985753919","full_name":"mishrahrishikesh/pmount-custom-linux-cmd","owner":"mishrahrishikesh","description":"Creating a custom Linux command pmount(permanent mount) which is used for permanently add the newly create partition to /etc/fstab","archived":false,"fork":false,"pushed_at":"2025-05-18T14:03:41.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T01:12:52.385Z","etag":null,"topics":["linux","linux-shell","rhel","rpm","rpm-packages","rpmbuild","shell-script"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mishrahrishikesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-18T13:09:04.000Z","updated_at":"2025-05-18T14:05:34.000Z","dependencies_parsed_at":"2025-05-18T14:45:31.662Z","dependency_job_id":null,"html_url":"https://github.com/mishrahrishikesh/pmount-custom-linux-cmd","commit_stats":null,"previous_names":["mishrahrishikesh/pmount-custom-linux-cmd"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mishrahrishikesh/pmount-custom-linux-cmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishrahrishikesh%2Fpmount-custom-linux-cmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishrahrishikesh%2Fpmount-custom-linux-cmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishrahrishikesh%2Fpmount-custom-linux-cmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishrahrishikesh%2Fpmount-custom-linux-cmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mishrahrishikesh","download_url":"https://codeload.github.com/mishrahrishikesh/pmount-custom-linux-cmd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mishrahrishikesh%2Fpmount-custom-linux-cmd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261452834,"owners_count":23160395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","linux-shell","rhel","rpm","rpm-packages","rpmbuild","shell-script"],"created_at":"2025-05-24T14:17:24.758Z","updated_at":"2026-05-17T19:07:23.528Z","avatar_url":"https://github.com/mishrahrishikesh.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pmount(Permanent Mount)\n\nThis repository contains the source files and RPM .spec file for the pmount utility.\nThe pmount script is a command-line tool designed for Linux system administrators to simplify the process of making a filesystem mount persistent across reboots. \n\nIt automatically detects the filesystem's UUID and type and adds the correct entry to /etc/fstab, then attempts to mount the filesystem.\nIt is particularly useful after creating new block devices like LVM Logical Volumes or partitions.\n\n## NAME\n\npmount - add a filesystem entry to /etc/fstab using UUID and mount it\n## INSTALLATION\nDownload .rpm file:\n\n`wget https://github.com/mishrahrishikesh/pmount-custom-linux-cmd/blob/main/pmount-1.0-1.amzn2023.noarch.rpm`\n\nInstall:\n\n`yum install \u003crpm-file\u003e.rpm`\n\nExample: `yum install pmount-1.0-1.amzn2023.noarch.rpm`\n\n## SYNOPSIS\n\n`pmount` [`OPTIONS`] *device_path* *mount_point_directory*\n\n## DESCRIPTION\n\n`pmount` is a shell script that automates the process of making a filesystem mount persistent across reboots. It is typically used by a system administrator after creating and formatting a new block device, such as an LVM Logical Volume or a partition, and wants to ensure it's mounted automatically on boot.\n\nThe script performs the following steps:\n\n* Validates that it is run with root privileges.\n* Handles `--version`, `--help`, and `-h` options if provided as the sole argument.\n* Validates that exactly two arguments, representing the block device path and the mount point directory, are provided for the main functionality.\n* Validates that the specified block device path exists and is a block device.\n* Validates that the specified mount point directory exists and is a directory.\n* Uses the `blkid(8)` command to reliably find the filesystem UUID and type of the block device. Exits if no filesystem UUID is found (i.e., the device is not formatted).\n* Checks if an entry for the found UUID (`UUID=...`) or the specified mount point already exists in `/etc/fstab`. If an entry is found, the script exits with an error to prevent duplicates or unintended modifications.\n* If no existing entry is found, it adds a new entry to `/etc/fstab` using the found UUID, the specified mount point, the determined filesystem type (or 'auto' as a fallback), and default mount options (`defaults 0 0`).\n* Attempts to mount all filesystems listed in `/etc/fstab` using `mount -a(8)` to verify the syntax of the new entry and the availability of the device.\n* Provides informative messages throughout the process and a success message if all steps complete without error.\n\nThis script requires root privileges to modify `/etc/fstab` and execute the `mount` command.\n\n## OPTIONS\n\n* `--version`: Show the script version number and exit.\n* `--help`, `-h`: Show a brief help message including usage and options, and exit.\n\n## ARGUMENTS\n\n* *device_path*: The absolute path to the block device containing the filesystem to be permanently mounted (e.g., /dev/sda1, /dev/mapper/myvg-mydata, /dev/disk/by-uuid/... ).\n* *mount_point_directory*: The absolute path to the existing directory where the filesystem should be mounted (e.g., /mnt/data, /srv/appdata). This directory must exist and be a directory before running the script.\n\n## EXAMPLES\n\n* `sudo pmount /dev/myvg/mydata /mnt/appdata`: Adds an /etc/fstab entry for the Logical Volume /dev/myvg/mydata using its UUID, setting the mount point to /mnt/appdata with default options, and attempts to mount it.\n* `sudo pmount /dev/sdb1 /var/lib/mysql`: Adds an /etc/fstab entry for the partition /dev/sdb1 using its UUID, setting the mount point to /var/lib/mysql with default options, and attempts to mount it.\n* `pmount --version`: Display the script version.\n* `pmount --help`: Display the help message.\n\n## EXIT STATUS\n\n* **0**: Success. The /etc/fstab entry was added and the mount attempt (mount -a) was successful.\n* **1**: Failure. An error occurred due to:\n    * Incorrect number of arguments or invalid argument used.\n    * Insufficient privileges (not run as root).\n    * Invalid device path or mount point (doesn't exist, wrong type).\n    * Inability to find a filesystem UUID for the device.\n    * An entry for the UUID or mount point already exists in `/etc/fstab`.\n    * A failure during the attempt to write the entry to `/etc/fstab`.\n    * A failure during the `mount -a` attempt (e.g., syntax error in fstab, device temporarily unavailable, filesystem issues).\n\nError messages are printed to standard error.\n\n## BUGS\n\nThe script exits if an entry for the UUID or mount point already exists. It does not attempt to update or modify existing entries. Manual editing of `/etc/fstab` is required in such cases.\n\nError messages from the final `mount -a` command might be generic; check system logs for details if it fails.\n\n## AUTHOR\n\nHrishikesh Mishra\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmishrahrishikesh%2Fpmount-custom-linux-cmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmishrahrishikesh%2Fpmount-custom-linux-cmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmishrahrishikesh%2Fpmount-custom-linux-cmd/lists"}