0

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)

france1
  • 184
  • 1
  • 14
  • 3
    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? – matigo Jun 30 '21 at 11:01
  • 3
    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 – vanadium Jun 30 '21 at 11:45
  • 1
    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. – Simon Banks Jun 30 '21 at 13:35
  • @vanadium they say swap is on an SSD, which is probably why they think it will be faster – not my real name Jul 03 '21 at 19:55
  • We may have an XY problem here. – vanadium Jul 04 '21 at 08:28
  • 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 – france1 Jul 04 '21 at 08:42

0 Answers0