
I am attempting to create a database index of a USB-drive using updatedb. I am using locate and updatedb version 0.26, on Linux Mint 20.3 using kernel 5.14.0-1042.
On the root directory of the USB drive, I ran
updatedb -l 0 -o test.db
creating test.db in the directory /media/user1/ARCH_04/.
And then I tried doing a search of this database for a file I know exists on the USB drive; the file in question has the path /media/user1/ARCH_04/2901506_Rawdata/2901506_ReadMe.txt
Running locate -d test.db 2901506*
produces no output. I thought the -d flag of the locate command was supposed to conduct the search using the provided database - what am I doing wrong?
답변1
Ok, I think I see what I did wrong - I neglected to use the -U flag to only scan the subtree rooted to the USB drive itself.
The correct command I should have used was:
updatedb -l 0 -o test.db -U .
running this command in the root directory of the USB drive.