So I have many VMs and havent found another way, apart from starting each one up and searching, to search them - and mounting each one, indexing it, then going on to the next seems to be the only way that I can figure? That said, what I have come up with is super basic, in part because I’ve never been able to figure out real programming, regardless it seems there has got to be a better way than:
I am sure this is not great for many reasons, one of which is it seems that running updatedb on the same location (/mnt/locatedb) overwrites what was written for whatever was indexed before and also mounted on /mnt/locatedb; also, I occasionally add new VMs, or delete VMs so I’d have to update the script everytime i did added/removed a VM
Any thoughts on how better to do this would be super appreciated!
You’ve tagged this with f32; are you using Fedora 32? If not, that tag should probably be removed
You are correct that the way you are using updatedb is not going to give you the desired results. The -U argument restricts what it scans, but it does not affect the storage of the discovered information. Most likely you’ll need to run something like this:
You could make this into a script which executes that process in a loop, with the list of VMs to be updated in an array at the top of the script.
A couple of other questions though:
These VMs are not live (running) when you are doing this, are they?
What do you perceive the value of running updatedb like this to be? If the VM contents have not changed, there is no need to update the database used by locate as it is still correct.
Thanks!
Yes, I am using fedora32, kinda (am using qubes and fedora32 is the host OS).
The way qubes is set up I believe it opens a copy so I think I can still mount the origonal files (need to check that though).
What I had in mind was to have a db of all files across all the VMs so i could just run the locate command and it would show me where/which-vm the file is (though this made me think of another issue as it doesnt differentiate between the different VMs, if i could have it append the VMs name to the begining of each line… but again, no clue if thats possible)
You’d still need to mount each VM’s filesystem on its own path, to keep them distinct, but you would not run updatedb in a chroot, you’d just run it like you had been doing previously. By mounting each VM filesystem on its own path, when locate gives you a result that result path will include the name of the VM.
Also, I’m sure you know this, but Fedora 32 is long past its end of support and there are no security fixes available for it. Be quite careful using it.
Thanks Again!
So in going with the way I had been doing it i’d just make a separate dir for every vm - doh, doable (life is hard when one is as lazy as me LOL).
As for Fedora 32, yeah this is brought up quite often in the community. I can’t pretend to understand all the intricacies apart from I should have said teh VMs sit on top of a hardened fed32 (which has practically no direct access to usb, network, etc) that sits on top of Xen. If you interested these links would likely be more informative than I could be. How to install software in dom0 and Note on dom0 and EOL
Pretty sure you can easily automate this task with a bash loop.
Using virsh and guestfs-tools is also possible if the virtualization is libvirt-compatible.
Much appreciated.
I think a bash loop (after looking at it) might be what I need/need-to-learn I did not know what to call it.
As for the virsh and guestfs-tools I will take a look at them, are they something that might be able to read/index the innards of VMs without having to mount said VMs?