Re: map/mount a directory/partition into memory

2022-04-08 Thread Stuart Henderson
On 2022-04-08, Stuart Henderson  wrote:
> On 2022-04-08, Stefan Hagen  wrote:
>> Mihai Popescu wrote (2022-04-08 05:17 CEST):
>>> Since my computer is struggling with chromium and I suspect it's the
>>> disk access being too slow, I want to map the directory accessed by
>>> chromium ( i think it is ~/.cache) into the memory.
>>> 
>>> Looking in the man, i spotted rd, but i think i need to setup this in
>>> the kernel.
>>> The next choice is tmpfs.
>>> The next one is mfs.
>>> 
>>> I have no experience with this stuff, so does it worth to take this 
>>> approach?
>>> If so, what is the recommended fs, please?
>>> Is it possible to map/mount a directory from a partition only, or is
>>> it the entire partition only accepted as a mount argument?
>
> Just as with a disk/network filesystem, you can mount it at whatever
> directory you like. So directly over /home/username/.cache is possible.
>
>> I haven't played with rd or tmpfs, but this works:
>
> rd is for creating the "ramdisk" kernel for the installer or similar
> use-cases.
>
> tmpfs is disabled in GENERIC kernels, so you'll need to build your own,
> and hope you don't run into the reason for it being disabled.
>
> mfs is probably right for this case (but do check speeds though;
> for Mihai's use-case it seems likely to be better, but a decent SSD is
> likely to be same/faster than mfs.

Since someone complained offlist that I didn't include figures:

# cd /mnt/mfs; for i in `jot 5`; do dd if=/dev/zero of=foo bs=1m count=990 2>&1 
| grep bytes; done
1038090240 bytes transferred in 2.641 secs (392976029 bytes/sec)
1038090240 bytes transferred in 2.627 secs (395040864 bytes/sec)
1038090240 bytes transferred in 2.660 secs (390203934 bytes/sec)
1038090240 bytes transferred in 2.693 secs (385398220 bytes/sec)
1038090240 bytes transferred in 2.688 secs (386081589 bytes/sec)
# cd ~; for i in `jot 5`; do dd if=/dev/zero of=foo bs=1m count=990 2>&1 | grep 
bytes; done  
1038090240 bytes transferred in 2.311 secs (449182544 bytes/sec)
1038090240 bytes transferred in 2.314 secs (448454320 bytes/sec)
1038090240 bytes transferred in 2.303 secs (450684315 bytes/sec)
1038090240 bytes transferred in 2.303 secs (450627092 bytes/sec)
1038090240 bytes transferred in 2.311 secs (449121684 bytes/sec)

Obviously it is going to vary by hardware, I have seen a bigger
difference before. In this case the drive is a SATA-connected Samsung
860 EVO 500GB (plain not softraid crypto) on an AMD EPYC running i386.

-- 
Please keep replies on the mailing list.



Re: map/mount a directory/partition into memory

2022-04-08 Thread Mihai Popescu
Thank you for your time. It took me some tests and thinking to figure
out i should try the ram disk/partition/directory/whatever. Just
curios, how many users are using this for chromium?

> Just as with a disk/network filesystem, you can mount it at whatever
> directory you like. So directly over /home/username/.cache is possible.

Yes and no, one need to use that  cryptic key instead of
disk/partition descriptor. There are some examples using the partition
descriptor. I don't know why, I didn't grasp it and i am too novice to
look at the source code.

> but do check speeds though

dd from /dev/zero to an mfs directory mapped into memory file is
almost 290GB/sec. Yes, at least the report says so.

> Permissions are probably wrong. Try this: [...]

chmod complain /tmp is a directory, I used -R, it was finishing fine,
but still no xenodm for login.
Got a pause to clear my confusion and maybe i will try again later.

Thanks



Re: map/mount a directory/partition into memory

2022-04-08 Thread Stuart Henderson
On 2022-04-08, Mihai Popescu  wrote:
>> swap /tmp mfs rw,nodev,nosuid,-s=1g 0 0
>
> for some reason, xenodm is not displayed and i am not able to login ...

Permissions are probably wrong. Try this:

- boot single-user
- mount -uw / (don't mount other filesystems)
- chmod 1777 /tmp
- reboot


-- 
Please keep replies on the mailing list.




Re: map/mount a directory/partition into memory

2022-04-08 Thread Stuart Henderson
On 2022-04-08, Stefan Hagen  wrote:
> Mihai Popescu wrote (2022-04-08 05:17 CEST):
>> Since my computer is struggling with chromium and I suspect it's the
>> disk access being too slow, I want to map the directory accessed by
>> chromium ( i think it is ~/.cache) into the memory.
>> 
>> Looking in the man, i spotted rd, but i think i need to setup this in
>> the kernel.
>> The next choice is tmpfs.
>> The next one is mfs.
>> 
>> I have no experience with this stuff, so does it worth to take this approach?
>> If so, what is the recommended fs, please?
>> Is it possible to map/mount a directory from a partition only, or is
>> it the entire partition only accepted as a mount argument?

Just as with a disk/network filesystem, you can mount it at whatever
directory you like. So directly over /home/username/.cache is possible.

> I haven't played with rd or tmpfs, but this works:

rd is for creating the "ramdisk" kernel for the installer or similar
use-cases.

tmpfs is disabled in GENERIC kernels, so you'll need to build your own,
and hope you don't run into the reason for it being disabled.

mfs is probably right for this case (but do check speeds though;
for Mihai's use-case it seems likely to be better, but a decent SSD is
likely to be same/faster than mfs.




Re: map/mount a directory/partition into memory

2022-04-08 Thread Mihai Popescu
> swap /tmp mfs rw,nodev,nosuid,-s=1g 0 0

for some reason, xenodm is not displayed and i am not able to login ...



map/mount a directory/partition into memory

2022-04-07 Thread Mihai Popescu
Hello,

Since my computer is struggling with chromium and I suspect it's the
disk access being too slow, I want to map the directory accessed by
chromium ( i think it is ~/.cache) into the memory.

Looking in the man, i spotted rd, but i think i need to setup this in
the kernel.
The next choice is tmpfs.
The next one is mfs.

I have no experience with this stuff, so does it worth to take this approach?
If so, what is the recommended fs, please?
Is it possible to map/mount a directory from a partition only, or is
it the entire partition only accepted as a mount argument?

Thank you.