[FIX] Can updatedb keep localpaths for removable drives that aren’t plugged in?

Question

I run updatedb like this: updatedb --localpaths="/a /b"

/a is a removable drive. /b is the local hard drive. Although /a‘s not always accessible to me, I frequently want to run locate to find if I have a certain file on it, based on the last time I ran updatedb.

The problem is, if I run updatedb when it’s not plugged in, I get an error:

/usr/bin/find: '/a': No such file or directory

The database gets the latest information about /b, but it removes /a‘s existing data. Is there a way to keep /a‘s data when /a isn’t plugged in during updatedb?

I think this might be possible with multiple databases, one for /a and another for /b. Then a script can check whether or not /a is plugged in when it decides whether or not to updatedb.

But the man page for both commands kind of assumes I know a lot more than I do (e.g., what FINDOPTIONS does), so I’m hoping there’s an easier solution to this problem.

Click Here to see answer

0
payam 2 weeks 2022-09-21T00:20:08+00:00 0 Answers 1 views

Leave an answer

By answering, you agree to the Terms of Service and Privacy Policy.