You are not logged in.

#1 2012-08-11 00:01:22

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

[SOLVED] Log files to symlinks in tempfs will not work?

To reduce write load to hard drive I am using symlinks to tempfs;

/etc/fstab creates a tempfs mount as usual


in rc.local I do:

mkdir /tmp/.cache
chown fafnir:root /tmp/.cache
mkdir /tmp/log

and having done

ln -s /tmp/.cache /home/fafnir/.cache
ln -s /tmp/log /var/log

I am getting errors on boot where log files cannot be created, eg dmesg saving it's boot log


Now what am I doing wrong?


[edit] typo fix

Last edited by dabbi2000 (2012-08-11 10:21:46)

Offline

#2 2012-08-11 00:04:28

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: [SOLVED] Log files to symlinks in tempfs will not work?

rc.local is exectued after dmesg is saved, so that won't work. You could remove those lines from rc.local and use tmpfiles.d instead (it has a manpage which should explain its use).

Offline

#3 2012-08-11 00:14:30

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

Re: [SOLVED] Log files to symlinks in tempfs will not work?

Hmm didn't know of that, thx!

I have been resisting to mount /var/log in fstab as I read that it takes up lots of megabytes even though it isn't being used... That would of course be the easiest solution but I don't want to waste all that RAM for nothing... or is that incorrect some how?

Offline

#4 2012-08-11 00:32:32

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [SOLVED] Log files to symlinks in tempfs will not work?

Do you mean you were thinking of creating it as its own temporary fs in fstab? E.g.:

tmpfs           /var/log    tmpfs   defaults    0       0

Or whatever?

I don't see how using a symlink will use less RAM, though. If the symlink method worked, you'd still have all those megabytes in RAM. Or have I misunderstood?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2012-08-11 01:09:08

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: [SOLVED] Log files to symlinks in tempfs will not work?

dabbi2000 wrote:

I have been resisting to mount /var/log in fstab as I read that it takes up lots of megabytes even though it isn't being used... That would of course be the easiest solution but I don't want to waste all that RAM for nothing... or is that incorrect some how?

That's incorrect. The "size" of a tmpfs partition, is its maximal size. It will only take up the size of the files you put on it. If you run low on ram, it will swap out those files to your swap partition, so you should be fine.

Offline

#6 2012-08-11 10:21:32

dabbi2000
Member
From: Reykjavik, Iceland
Registered: 2011-09-28
Posts: 119
Website

Re: [SOLVED] Log files to symlinks in tempfs will not work?

Aah, my mistake - I read it wrong. The of course tmpfs is the obvious solution. Thx!

Offline

Board footer

Powered by FluxBB