LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-16-2024, 03:06 PM   #1
Frickymind
LQ Newbie
 
Registered: Apr 2019
Posts: 29

Rep: Reputation: Disabled
How can I create a search or locate database of an external 4tb hard drive?


Hi,
I have a couple of 4tb USB hard drives. On my desktop I use the Catfish file search or krusader to find files on my home ssd. I want to create a search index or database on my external drives that lets me search through the drives when they are connected, preferably using a gui interface. Is there any way to do this?
 
Old 03-16-2024, 04:39 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
Search the file tree of the mount point.

If you have a ntfs drive mounted at /mnt/disk1, then search the file tree that descends from that mount point.

Code:
/mnt
    /disk1
        /dir1
            subdir1
            subdir2
        /dir2
        /dir3
you can use any search tools that you want.
Code:
find /mnt/disk1/dir1/subdir1 -name myfile.txt
I think that mlocate works well with a database it makes.

Edit:
https://pagure.io/mlocate
https://plocate.sesse.net

Last edited by teckk; 03-16-2024 at 04:41 PM.
 
Old 03-16-2024, 05:03 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
updatedb by default excludes /media but I assume your USB drives are not always mounted. You can create a separate mlocate database but I do not know if you can select which one to search in krusader. You might be able to specify both using the environmental variable LOCATE_PATH separating the two databases with a ":"

Normally locate searches a database but the search results may not be complete depending on when the last updatedb was executed which is usually via anacron. With external drives if you want to use locate and if you update their contents frequently then you will need to manually run updatedb. If you want to only search the USB drives when they are mounted then using "live" search might be a better method.

Last edited by michaelk; 03-16-2024 at 05:46 PM.
 
Old 03-17-2024, 08:31 AM   #4
Frickymind
LQ Newbie
 
Registered: Apr 2019
Posts: 29

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
Search the file tree of the mount point.

If you have a ntfs drive mounted at /mnt/disk1, then search the file tree that descends from that mount point.

Code:
/mnt
    /disk1
        /dir1
            subdir1
            subdir2
        /dir2
        /dir3
you can use any search tools that you want.
Code:
find /mnt/disk1/dir1/subdir1 -name myfile.txt
I think that mlocate works well with a database it makes.

Edit:
https://pagure.io/mlocate
https://plocate.sesse.net
Thanks. I'll try it. Is the code below for the terminal?
Code:
/mnt
    /disk1
        /dir1
            subdir1
            subdir2
        /dir2
        /dir3
 
Old 03-17-2024, 08:33 AM   #5
Frickymind
LQ Newbie
 
Registered: Apr 2019
Posts: 29

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
updatedb by default excludes /media but I assume your USB drives are not always mounted. You can create a separate mlocate database but I do not know if you can select which one to search in krusader. You might be able to specify both using the environmental variable LOCATE_PATH separating the two databases with a ":"

Normally locate searches a database but the search results may not be complete depending on when the last updatedb was executed which is usually via anacron. With external drives if you want to use locate and if you update their contents frequently then you will need to manually run updatedb. If you want to only search the USB drives when they are mounted then using "live" search might be a better method.
Yeah, the problem is that they are mounted only occasionally. I want each disk to have its own database separate from my desktop's.
 
Old 03-17-2024, 09:40 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
You can easily create a separate database:
Quote:
updatedb -l 0 -o /path/to/database -U /path_to/USB/
And you can search a separate database using the cli.

Quote:
locate -d /path/to/database PATTERN
I don't know if there is a way to specify a particular database in krusader. There are many ways to create a simple dialog based search tool using yad, zenity or dialog if desired.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I seem to have bricked an external hard drive after formatting it to NTFS (Linux Mint Cinnamon, Seagate 4TB HDD) Messed_Up_Linux Linux - Hardware 16 05-12-2021 07:24 PM
Ubuntu cannot access my 4TB external hard disk snowmagician Linux - Newbie 4 06-08-2020 06:46 AM
Ubuntu cannot access my 4TB external hard disk snowmagician Linux - Newbie 1 06-07-2020 03:43 PM
4TB HD on Kubuntu 14.10 - shows as 2tb (1.7 actually) but Fdisk says 4TB. - What can I do? cilbuper Linux - Hardware 10 12-14-2015 06:34 PM
ubuntu installed on external hard drive, can't startup without external hard drive. Vanostaajen Linux - Software 23 01-20-2009 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration