Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7043153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:15:16+00:00 2026-05-28T02:15:16+00:00

I am working on a bash script that is designed to tell whether or

  • 0

I am working on a bash script that is designed to tell whether or not a given drive is attached to the system, and if it is, to copy some data (backups that need to be taken off-site) to that drive.

What I’d like to do is identify the drive/partition by UUID, so that I can have a script that frequently scans for the presence of that drive, and when it’s plugged in, copies data to it (via rsync, so I don’t particularly care if that part runs more than once, because the later runs are I/O-cheap). I want this to be as simple as possible so that I can hand the drive in question to a non-technical person and say “plug it in here, then unplug it later and take it with you.”

I can’t seem to find any options in mount that quite do this, and grepping through /etc/fstab doesn’t tell me whether a drive is actually mounted or not.

How can I tell, given a UUID, whether or not a drive with that UUID is mounted and what its mount point is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:15:16+00:00Added an answer on May 28, 2026 at 2:15 am

    /dev/disk/by-uuid/ is a symlink farm for attached volumes. It won’t tell you if the volume is mounted or not but will tell you if it’s plugged in – so might address your particular use case anyway.

    $ ls -l /dev/disk/by-uuid/
    total 0
    lrwxrwxrwx 1 root root 10 Nov 22 10:08 b928a862-6b3c-45a8-82fe-8f1db2863be3 -> ../../dm-0
    lrwxrwxrwx 1 root root 10 Dec  8 14:33 e37fab85-9b00-4d9b-b25e-0970d6eaa3fa -> ../../sdg1
    
    $ readlink /dev/disk/by-uuid/b928a862-6b3c-45a8-82fe-8f1db2863be3 
    ../../dm-0
    

    Does that help?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Bash shell script that does something like this: #!/bin/bash
I'm working on a Bash shell script that runs several Python scripts like so:
I am working on a bash script where I need to conditionally execute some
I'm working with a bash script that is currently working on a server (RHEL4).
Working with printf in a bash script, adding no spaces after \n does not
Working in bash under Linux ubuntu 10 here I have Bash script that reads
I am working on a Bash script (see below) that recursively searches through directories
I have the following bash script (.sh) that's working just fine in Unix. I'd
I am working on a bash script using sed and cut that will take
I am working on a bash script that needs to take a single line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.