Score:0

'Preload' files into swap instead of RAM / add more ram without open computer

ng flag

I would apprechiate to load files from a HDD to RAM. I do not want to create a tmpf or anything. The files should go to swap. I can't push them into RAM because no free ram anymore.

The Problems are: Ubuntu doesn't cache the files from a nextcloud server. Because I'm using an HDD it can be very slow - I also have a Minecraft Server running so no more RAM free. Linux doesn't put the files to swap wich is quite interresting. I have a 10 GB of swap

Now my question: How can I load files into swap wich is on a sdd? I want to load for example the dashboard page into swap so no long waiting time

Edit: So I heard this isn't possible... I now figured out that I have much more ressources with zram but also kinda weak... I used vmtouch to lock files... But it doesn't help really... I locked all files from /var/www/html into ram but my hdd still triggered while I went to localhost/ What kinda problem is this???? I don't know if it worked but it increased RAM usage and with killall I was able to release

I just want to make my HDD faster... I do not want to move html/ onto my SSD

Another Edit: It also might help adding some RAM but I can't add because it's an Apple Laptop Any Idea how else it can work? Like fake ram (I never heard of things like that)

in flag
Swap isn’t for complete files, as that doesn’t make logical sense. System swap will move at the same speed as files stored on a file system. If you are looking for a way to cache files from NextCloud into a memory based system for faster retrieval, then you’ll need to look at using Squid or something similar. Mind you, this will use more resources, which you’ve said your system doesn’t have. Perhaps you can [edit] your question to explain your ultimate goal? What do you need your system to do?
vanadium avatar
cn flag
Swap also is not RAM: it is storage on disk. So storing files on disks to swap on disk would not be very effective, it it were possible. Swap is disk cache for RAM, files are not cached because they can be retrieved from disk. See also: http://mywiki.wooledge.org/XyProblem
in flag
Swap/RAM are 'Virtual memory' you can't choose to use SWAP.. SWAP is where the kernel moves processes out of RAM on demand. Perhaps you should look at using mmap(). It allows you to page in a file as memory.
Ray Wu avatar
ng flag
@vanadium they say swap is on an SSD, which is probably why they think it will be faster
vanadium avatar
cn flag
We may have an XY problem here.
france1 avatar
ng flag
Yes it's right but if you know one you can answer one. I just added the next question because it also would be that I need
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.