Score:0

Mounting local and S3 storage to the same folder location?

ve flag

Using Oracle Linux 8, I have a /usr/local/caplogs/logs folder which has logs from my services written to it constantly. I have S3 storage, which I have attached to /usr/local/caplogs/logarchive using S3-FUSE which works superb, I then take anything that is 28 days old, move it to the archive folder which pushes to the cloud host.

What I am trying to achieve is to remove the logarchive folder and just map it to the logs directory. The problem there is I need to retain local 28 days of logs as I need to graph and output reports from the local disk which is in subnet with my graphing box. I can write to the cloud, but I can't read from it, it gets read from a specific source as we limit the API to a specific external host and username/keypair. I 'could' cut holes in this, but there are some security concerns with doing so. I could also 'copy' rather than move, but the cost of local storage vs cloud storage is why we have gone down this route and I need to keep ~3 years of storage in the cloud, which would be close to 300TB minimum local space which we would need to pay for in physical and cloud.

Essentially I would like; /usr/local/caplogs/logs -- <28days local on /dev/sda1 /usr/local/caplogs/logs -- 29+ days remote on /s3-amazon etc

Is there any magical way to achieve this. I've looked into a few options but nothing suggests to do what I would like to achieve.

Thanks in advance!

Score:0
jp flag

It is not possible to mount two filesystems at the same mountpoint at the same time. The latest one will override the former making it inaccessible from that mount point. It is recommended to mount filesystems on empty directories.

mount(8) puts it this way:

The previous contents (if any) and owner and mode of dir become invisible, and as long as this filesystem remains mounted, the pathname dir refers to the root of the filesystem on device.

From David Both's Using and Administering Linux: Volume 1 (2020), p. 561 (also available at opensource.com & cited at libretexts.org):

If you mount a filesystem on an existing directory or filesystem, the original contents will be hidden and only the content of the newly mounted filesystem will be visible.

Disparity avatar
ve flag
Hello, thanks for taking the time to answer. I was having a play last night and indeed, what you say does happen, the current files are hidden, the mounted share takes over, umount takes it back to the previous setup. At least it answers the question, I will look at other avenues. Thank you.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.