You are not logged in.
I have spare m.2 SSD which I use for SWAP, but I have huge space left which is unused, so I would like to use it for cache / temp files too (so I can save some writes on my systems SSD).
I created entry in fstab file for that partition with unused space like:
`/dev/disk/by-uuid/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 /mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 auto nosuid,nodev,nofail 0 0`
then I created some "folder structure" of cache / temp folders in that partition (according to systems file structure), like:
-/home/username/.cache
-/var/
-/cache/
-/temp/
-/tmp/
Now I wonder what is the best way to map real system folders on system SSD to these folders on cache SSD, I was thinking about softlink like "ln -s", or map every folder like new entry in fstab file? I don't know what is recommended.
Second question is there any failsafe mechanism? I mean if my cache SSD corrupts, or I will need to boot up PC without that cache SSD? Because I found out that if cache folder is not accessible many things doesn't work, like terminal (so I had to go to the TTY). So by failsafe mechanism Im thinking something like that if there is not that cache SSD it will create cache / temp folders as they should be, and if there is, it should read / write to that cache SSD.
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
In my use case, the bulk of the space taken by /var/cache comes from /var/cache/pacman/pkg, which is basically just an archive of packages downloaded from the arch repo during package installs and updates. What I did was transferred this folder to another drive, then bind mount /var/cache/pacman/pkg to that folder from /etc/fstab/
If the other drive fails for some reason, you can just remove the bind mount to that folder from /etc/fstab, which will leave you with an empty /var/cache/pacman/pkg folder. The system will continue to run. The only downside is you no longer have those old packages ready for downgrade, something I never had a need to do in my years of using arch.
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Offline
is possible to mount folder to other folder using fstab or I will need to create partition for every mount?
like according to my fstab file, I could use it like:
/mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80/cache/home/username/.cache
/mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80/cache/var/cache
/mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80/cache/var/temp
on single mounted point "/mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80/" I hope you understand me ![]()
/mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80/cache/tmp
EDIT:
ah it should be possible like?
/mnt/5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80/cache/var/cache /var/cache none bind
Last edited by tomsk (2024-01-31 12:22:47)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
This is my actual fstab entry:
/data/pacman /var/cache/pacman/pkg none defaults,bind 0 0/data is the partition. It has its own mount entry in fstab.
/data/pacman is the folder inside the partition.
To answer your question, you don't need a separate partitions to bind mount it to. Just individual folders within the partition.
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Offline
So this is my actual chunk of fstab file for that cache SSD:
# swap on separate ssd
UUID=e33ecb6b-353f-428e-b9d7-2f0d94f66b03 none swap sw 0 0
# cache folders on separate ssd
UUID=5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 /mnt/cache_temp ext4 defaults 0 0
/mnt/cache_temp/tmp/ /tmp none defaults,bind 0 0
/mnt/cache_temp/var/cache /var/cache none defaults,bind 0 0
/mnt/cache_temp/var/tmp /var/tmp none defaults,bind 0 0
#/mnt/cache_temp/home/tomsk/.cache /home/tomsk/.cache none defaults,bind 0 0problem is that, gnome disk utility shows that partition "5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80" is mounted at /mnt/cache_temp which is correct, but when I uncomment last line, then gnome disk utility shows that partition is mounted at /home/tomsk/.cache, whyy? it should stay at /mnt/cache_temp
Last edited by tomsk (2024-01-31 13:17:10)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
I don't use gnome disk utility so I can't answer your question.
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Offline
so fstab looks good according you?
another issue I found is that /home/tomsk/cache has root permissions, so it is not readable/writable for user
Last edited by tomsk (2024-01-31 13:50:00)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
so fstab looks good according you?
another issue I found is that /home/tomsk/cache has root permissions, so it is not readable/writable for user
Of coure it does:
#/mnt/cache_temp/home/tomsk/.cache /home/tomsk/.cache none defaults,bind 0 0
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
tomsk wrote:so fstab looks good according you?
another issue I found is that /home/tomsk/cache has root permissions, so it is not readable/writable for user
Of coure it does:
tomsk wrote:#/mnt/cache_temp/home/tomsk/.cache /home/tomsk/.cache none defaults,bind 0 0
I dont understand what do you mean, my actual fstab is:
# swap on separate ssd
UUID=e33ecb6b-353f-428e-b9d7-2f0d94f66b03 none swap sw 0 0
# cache folders on separate ssd
UUID=5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 /mnt/cache_temp ext4 defaults 0 0
/mnt/cache_temp/tmp/ /tmp none defaults,bind 0 0
/mnt/cache_temp/var/cache /var/cache none defaults,bind 0 0
/mnt/cache_temp/var/tmp /var/tmp none defaults,bind 0 0
/mnt/cache_temp/home/tomsk/cache /home/tomsk/.cache none defaults,bind,user 0 0defaults should give read/give permissions, but I cannot create new files inside that folder
Last edited by tomsk (2024-01-31 14:03:00)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Who's owning /mnt/cache_temp/home ?
# ls -adnR /mnt/cache_temp/#/mnt/cache_temp/home/tomsk/.cache /home/tomsk/.cache none defaults,bind 0 0when I uncomment last line, then gnome disk utility shows that partition is mounted at /home/tomsk/.cache, whyy?
Leave it uncommented, then:
# findmnt /mnt/cache_temp/home/tomsk/.cache
# findmnt /home/tomsk/.cache
# mount | grep tomsk<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
╭─ ~ ✔ 15:30:09 ─╮
╰─ findmnt /mnt/cache_temp/home/tomsk/cache ─╯
╭─ ~ 1 ✘ 15:30:21 ─╮
╰─ findmnt /home/tomsk/.cache ─╯
TARGET SOURCE FSTYPE OPTIONS
/home/tomsk/.cache /dev/nvme0n1p1[/home/tomsk/cache] ext4 rw,nosuid,nodev,noexec,relatime
╭─ ~ ✔ 15:30:28 ─╮
╰─ mount | grep tomsk ─╯
/dev/nvme0n1p1 on /home/tomsk/.cache type ext4 (rw,nosuid,nodev,noexec,relatime,user)
/dev/sdd1 on /run/media/tomsk/Data type ext4 (rw,relatime)
/dev/sde1 on /run/media/tomsk/Games type ext4 (rw,relatime)
/dev/sdc1 on /run/media/tomsk/Data/VMs type ext4 (rw,relatime)
/dev/sr0 on /run/media/tomsk/SH5_CZ type udf (ro,nosuid,nodev,relatime,uid=1000,gid=985,iocharset=utf8,uhelper=udisks2)and actual fstab file:
# swap on separate ssd
UUID=e33ecb6b-353f-428e-b9d7-2f0d94f66b03 none swap sw 0 0
# cache folders on separate ssd
UUID=5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 /mnt/cache_temp ext4 defaults 0 0
/mnt/cache_temp/tmp/ /tmp none defaults,bind 0 0
/mnt/cache_temp/var/cache /var/cache none defaults,bind 0 0
/mnt/cache_temp/var/tmp /var/tmp none defaults,bind 0 0
/mnt/cache_temp/home/tomsk/cache /home/tomsk/.cache none defaults,bind,user 0 0I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
but when I uncomment last line, then gnome disk utility shows that partition is mounted at /home/tomsk/.cache, whyy? it should stay at /mnt/cache_temp
I likewise have zero experience w/ the gnome tool, but if you check the output of "mount" you'll see that all bind mounts target the device that holds the mountpoint of the bind target path.
ie. 5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 (supposingly nvme0n1p1) is mounted at /mnt/cache_temp everything that binds anything in that path will show nvme0n1p1 on the left column.
If the gnome gui tries to mangle that into a single (or minimum amount of) value(s) it might just be "confused" by the setup because, I assume /home is a separate partition?
Are you btw. sure that you want the tmpfs mountpoints on the SSD?
There's gonna by high fluctuation of supposingly volatile and typically small data.
Offline
ie. 5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 (supposingly nvme0n1p1) is mounted at /mnt/cache_temp everything that binds anything in that path will show nvme0n1p1 on the left column.
If the gnome gui tries to mangle that into a single (or minimum amount of) value(s) it might just be "confused" by the setup because, I assume /home is a separate partition?
No home is not in separate partition, I have main SSD (500GB) which is mounted at "/" like this https://imgur.com/NXzvKWN, then I have second SSD (256GB) just for SWAP and cache as like this: https://imgur.com/a/6VCJ0Zw
Are you btw. sure that you want the tmpfs mountpoints on the SSD?
There's gonna by high fluctuation of supposingly volatile and typically small data.
Yeah I want, because they are already on my main SSD, so I want to move them to second SSD (which is cheap and according benchmark it has 1.8GB/s speed so it should be fine for cache).
Edit:
this is how my .config folder looks like in my home directory (there is lock icon): https://imgur.com/JoQYRSe
and this is how permissions looks like of that folder: https://imgur.com/79PSnvE its root
Last edited by tomsk (2024-01-31 18:08:10)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Who's owning /mnt/cache_temp/home ?
# ls -adnR /mnt/cache_temp/
Please provide us textual output.
Watch out the dots (tomsk/cache != tomsk/.cache)!!!
And fix your permissions within /mnt.
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
This is output from ls -adnR /mnt/cache_temp/ --> https://www.paste.sh/bYNgwE0U#h-ThAKZ9SI8dS-FJgVHL0THb (I copied existing cache files)
Watch out the dots (tomsk/cache != tomsk/.cache)!!!
I know, in home directory it is hidden (dot), but in cache SSD it is not hidden (without dot)
And fix your permissions within /mnt.
I dont know how to fix it, because by default fstab makes it for root user
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
I dont know how to fix it, because by default fstab makes it for root user
Well? Then, change the deaults, no? ![]()
Unices filesystems simply want the permissions to be set by the user, eg.:
# chown -R MYBEAUTIFULUSER:MYAWESOMEGROUP /some/path/I/want/to/own<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
Thank you, I did chown -R tomsk:users and it looks like I have permissions in .cache folder now, but I still dont know why this is happening and I dont know if it is working correctly:
╭─ ~ ✔ 21:32:05 ─╮
╰─ mount | grep tomsk ─╯
/dev/sdd1 on /run/media/tomsk/Data type ext4 (rw,relatime)
/dev/sde1 on /run/media/tomsk/Games type ext4 (rw,relatime)
/dev/sdc1 on /run/media/tomsk/Data/VMs type ext4 (rw,relatime)
/dev/nvme0n1p1 on /home/tomsk/.cache type ext4 (rw,nosuid,nodev,noexec,relatime,user)
/dev/sr0 on /run/media/tomsk/SH5_CZ type udf (ro,nosuid,nodev,relatime,uid=1000,gid=985,iocharset=utf8,uhelper=udisks2)
╭─ ~ ✔ 21:32:58 ─╮
╰─ findmnt /home/tomsk/.cache ─╯
TARGET SOURCE FSTYPE OPTIONS
/home/tomsk/.cache /dev/nvme0n1p1[/home/tomsk/cache] ext4 rw,nosuid,nodev,noexec,relatimeI mean this it stills mounts "/dev/nvme0n1p1 on /home/tomsk/.cache type ext4 (rw,nosuid,nodev,noexec,relatime,user)", but it should be like "/mnt/cache_temp" to mount all directories, I hope you understand
that I dont see mount points for other folders
Last edited by tomsk (2024-01-31 20:45:12)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Comment again /mnt/cache_temp/home/tomsk/cache /home/tomsk/.cache none defaults,bind,user 0 0 and reboot.
After rebooting:
$ mv $HOME/.cache $HOME/backup.cache
$ mkdir $HOME/.cache
$ sudo mount --bind /mnt/cache_temp/home/tomsk/cache $HOME/.cache/
$ findmnt -R /dev/DEVICE_WHICH_IS_MOUNTED_BELOW_THE_/mnt_FOLDER<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
Comment again /mnt/cache_temp/home/tomsk/cache /home/tomsk/.cache none defaults,bind,user 0 0 and reboot.
After rebooting:$ mv $HOME/.cache $HOME/backup.cache $ mkdir $HOME/.cache $ sudo mount --bind /mnt/cache_temp/home/tomsk/cache $HOME/.cache/ $ findmnt -R /dev/DEVICE_WHICH_IS_MOUNTED_BELOW_THE_/mnt_FOLDER
╭─ ~ ✔ 13:47:16 ─╮
╰─ findmnt -R /dev/nvme0n1p1 ─╯
TARGET SOURCE FSTYPE OPTIONS
/mnt/cache_temp /dev/nvme0n1p1 ext4 rw,relatime
/home/tomsk/.cache /dev/nvme0n1p1[/home/tomsk/cache] ext4 rw,relatimeI use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
So?
I found some issues with that mapping of .cache folder, like this https://github.com/romkatv/gitstatus/issues/422 or when I develop something in Rust (Tauri) I get this error:
2024-02-22T07:54:44.121559Z INFO fetching cargo artifacts
2024-02-22T07:54:44.242885Z INFO processing WASM for frontend
2024-02-22T07:54:44.262048Z INFO calling wasm-bindgen for frontend
2024-02-22T07:54:44.263617Z ERROR ❌ error
error from HTML pipeline
Caused by:
0: error from asset pipeline
1: error spawning wasm-bindgen call
2: Permission denied (os error 13)so there is somethign wrong with my fstab I guess
my actual fstab:
# swap on separate ssd
UUID=e33ecb6b-353f-428e-b9d7-2f0d94f66b03 none swap sw 0 0
# cache folders on separate ssd
UUID=5f0ddbbd-9b8e-4499-8ccd-8e6993eb6c80 /mnt/cache_temp ext4 defaults 0 0
/mnt/cache_temp/home/tomsk/cache /home/tomsk/.cache none defaults,bind,user 0 0
/mnt/cache_temp/tmp/ /tmp none defaults,bind 0 0
/mnt/cache_temp/var/cache /var/cache none defaults,bind 0 0
/mnt/cache_temp/var/tmp /var/tmp none defaults,bind 0 0Last edited by tomsk (2024-02-22 07:58:56)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
The normal file access permissions still apply.
stat /tmp /var/cache /var/tmpThe "tmp" ones should be 1777
Offline
╰─ stat /tmp /var/cache /var/tmp ─╯
File: /tmp
Size: 36864 Blocks: 80 IO Block: 4096 directory
Device: 259,1 Inode: 2752513 Links: 396
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-02-22 08:05:33.627441823 +0100
Modify: 2024-02-22 11:35:30.067124956 +0100
Change: 2024-02-22 11:35:30.067124956 +0100
Birth: 2024-01-31 13:49:08.739257115 +0100
File: /var/cache
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 259,1 Inode: 11272194 Links: 10
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-02-16 16:52:05.856513719 +0100
Modify: 2024-02-16 16:45:49.988231744 +0100
Change: 2024-02-16 16:45:49.988231744 +0100
Birth: 2024-01-31 13:49:08.741257090 +0100
File: /var/tmp
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 259,1 Inode: 11272195 Links: 10
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-02-16 16:10:17.710100512 +0100
Modify: 2024-02-22 10:26:12.861586956 +0100
Change: 2024-02-22 10:26:12.861586956 +0100
Birth: 2024-01-31 13:49:08.742257078 +0100Hmm it is 177, but /var/cache is 0755
╰─ stat /home/tomsk/.cache ─╯
File: /home/tomsk/.cache
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 259,1 Inode: 6029315 Links: 41
Access: (0755/drwxr-xr-x) Uid: ( 1000/ tomsk) Gid: ( 985/ users)
Access: 2024-02-17 16:51:54.808539958 +0100
Modify: 2024-02-22 11:37:16.965796749 +0100
Change: 2024-02-22 11:37:16.965796749 +0100
Birth: 2024-01-31 13:49:08.672257958 +0100and home cache is 0755 too
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Hmm I think 1777 permissions are wrong, because I get then error in Wine:
wineserver: /tmp/.wine-1000 must not be accessible by other users
gamemodeauto:
wine: '/tmp/.wine-1000/server-841-3ec2491' must not be accessible by other usersEdit: ah okay I deleted that folder /tmp/.wine-1000 and it works now, but still issues with terminal and Rust (tauri) apps
Last edited by tomsk (2024-02-23 07:53:47)
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Do these testcases actually behave themselves when not using the bind mounts?
Could be totally unrelated and just a bug in that application.
"error spawning wasm-bindgen call" sounds like sth. lacks the executable bit
You btw. also want to mount /tmp w/ "nosuid,nodev"
Offline