Hi
May I ask for help with this again please?
I’m trying to ensure that Samba writes its wins.dat file to tmpfs.
I have added these mount commands to /etc/init.d/samba:
case $1 in
start)
mount -t tmpfs tmpfs /var/run/samba
mount -t tmpfs tmpfs /var/cache/samba
/etc/init.d/nmbd start
/etc/init.d/smbd start
/etc/init.d/samba-ad-dc start
;;
stop)
but I’m not certain that wins.dat is now in tmpfs.
Are my edits correct for what I’m trying to do?
Best regards
David
From: DavidA
Sent: Tuesday, February 02, 2016 11:00 PM
To: samba at lists.samba.org
Subject: A question about Samba logging
Hi
I run the system partition for my Raspberry Pi Samba server off a USB hard disk.
I want the disk to sleep when not accessed for user data so I want log files to
live in tmpfs. Currently, if I put the drive in standby (using hdparm) it
immediately wakes again. I search for files changed very recently and see:
$ sudo /usr/local/sbin/ff_changed 1
Search whole filesystem for changed files in the last 1 minutes
/dev/xconsole
/var/lib/samba
/var/lib/samba/wins.dat
/var/lib/sudo/ts/david
/var/log/auth.log
Is there something I should do to ensure that Samba logs are directed to tmpfs?
Best regards
David
Hai David,
What you want is possible, i would do something like this.
I've not tested it but read it, its a good pointer howto do this.
Debian used systemd. Close your eyes Rowland.... ;-)
Im still learning things about systemd, so if some sees things that needs to be
corrected please tell us.
To remember! Files in /etc/tmpfiles.d override files with the same name
in /usr/lib/tmpfiles.d
so knowing this ..
cp /usr/lib/tmpfiles.d/samba.conf /etc/tmpfiles.d/samba.conf
and add to this file
d /run/samba/varcache 0755 root root -
d /run/samba/varlib 0755 root root -
This solves the problem of the needed tmpfs folders
Now you problely also want to backup the content of these
when stopping samba and put it back when you start samba.
This might be bit faultly, and may need corrections.
Create the samba2ram.service folder to add this service file.
/etc/systemd/system/samba2ram.service
chmod 664 /etc/systemd/system/samba2ram.service
add something like this to the service file.
[Unit]
Description=Samba tmpfs copy/restore to ramdisk
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/samba2ramfs.sh
ExecStop=/usr/local/sbin/samba2ramfs.sh
Before=samba.service
RemainAfterExit=yes
[Install]
WantedBy=multiuser.target
Example very simple copy script.
/usr/local/sbin/samba2ramfs.sh
#!/bin/bash
if [ "${1}" = "start" ]; then
cp -R /var/cache/samba /run/samba/varcache
cp -R /var/lib/samba /run/samba/varlib
fi
if [ "${1}" = "stop" ]; then
cp -R /run/samba/varcache /var/cache/samba
cp -R /run/samba/varlib /var/lib/samba
fi
and enable the service.
systemctl enable samba2ram.service
test : systemctl start samba2ram.service
or reboot the system.
Greetz,
Louis
> -----Oorspronkelijk bericht-----
> Van: samba [mailto:samba-bounces at lists.samba.org] Namens DavidA
> Verzonden: donderdag 4 februari 2016 22:25
> Aan: samba at lists.samba.org
> Onderwerp: Re: [Samba] A question about Samba logging
>
> Hi
>
> May I ask for help with this again please?
>
> I’m trying to ensure that Samba writes its wins.dat file to tmpfs.
>
> I have added these mount commands to /etc/init.d/samba:
>
> case $1 in
> start)
> mount -t tmpfs tmpfs /var/run/samba
> mount -t tmpfs tmpfs /var/cache/samba
> /etc/init.d/nmbd start
> /etc/init.d/smbd start
> /etc/init.d/samba-ad-dc start
> ;;
> stop)
>
> but I’m not certain that wins.dat is now in tmpfs.
>
> Are my edits correct for what I’m trying to do?
>
> Best regards
>
> David
>
> From: DavidA
> Sent: Tuesday, February 02, 2016 11:00 PM
> To: samba at lists.samba.org
> Subject: A question about Samba logging
>
> Hi
>
> I run the system partition for my Raspberry Pi Samba server off a USB hard
> disk. I want the disk to sleep when not accessed for user data so I want
> log files to live in tmpfs. Currently, if I put the drive in standby
> (using hdparm) it immediately wakes again. I search for files changed
> very recently and see:
>
> $ sudo /usr/local/sbin/ff_changed 1
> Search whole filesystem for changed files in the last 1 minutes
> /dev/xconsole
> /var/lib/samba
> /var/lib/samba/wins.dat
> /var/lib/sudo/ts/david
> /var/log/auth.log
>
> Is there something I should do to ensure that Samba logs are directed to
> tmpfs?
>
> Best regards
>
> David
> --
> To unsubscribe from this list go to the following URL and read the
> instructions: https://lists.samba.org/mailman/options/samba
On 05/02/16 10:06, L.P.H. van Belle wrote:> Hai David, > > What you want is possible, i would do something like this. > I've not tested it but read it, its a good pointer howto do this. > > Debian used systemd. Close your eyes Rowland.... ;-) > Im still learning things about systemd, so if some sees things that needs to be corrected please tell us. > > To remember! Files in /etc/tmpfiles.d override files with the same name > in /usr/lib/tmpfiles.d > > so knowing this .. > cp /usr/lib/tmpfiles.d/samba.conf /etc/tmpfiles.d/samba.conf > and add to this file > d /run/samba/varcache 0755 root root - > d /run/samba/varlib 0755 root root - > > This solves the problem of the needed tmpfs folders > > > Now you problely also want to backup the content of these > when stopping samba and put it back when you start samba. > This might be bit faultly, and may need corrections. > > Create the samba2ram.service folder to add this service file. > /etc/systemd/system/samba2ram.service > chmod 664 /etc/systemd/system/samba2ram.service > add something like this to the service file. > > [Unit] > Description=Samba tmpfs copy/restore to ramdisk > > [Service] > Type=oneshot > ExecStart=/usr/local/sbin/samba2ramfs.sh > ExecStop=/usr/local/sbin/samba2ramfs.sh > Before=samba.service > RemainAfterExit=yes > > [Install] > WantedBy=multiuser.target > > Example very simple copy script. > /usr/local/sbin/samba2ramfs.sh > #!/bin/bash > > if [ "${1}" = "start" ]; then > cp -R /var/cache/samba /run/samba/varcache > cp -R /var/lib/samba /run/samba/varlib > fi > > if [ "${1}" = "stop" ]; then > cp -R /run/samba/varcache /var/cache/samba > cp -R /run/samba/varlib /var/lib/samba > fi > > and enable the service. > systemctl enable samba2ram.service > test : systemctl start samba2ram.service > or reboot the system. > > > Greetz, > > Louis > > > > >> -----Oorspronkelijk bericht----- >> Van: samba [mailto:samba-bounces at lists.samba.org] Namens DavidA >> Verzonden: donderdag 4 februari 2016 22:25 >> Aan: samba at lists.samba.org >> Onderwerp: Re: [Samba] A question about Samba logging >> >> Hi >> >> May I ask for help with this again please? >> >> I’m trying to ensure that Samba writes its wins.dat file to tmpfs. >> >> I have added these mount commands to /etc/init.d/samba: >> >> case $1 in >> start) >> mount -t tmpfs tmpfs /var/run/samba >> mount -t tmpfs tmpfs /var/cache/samba >> /etc/init.d/nmbd start >> /etc/init.d/smbd start >> /etc/init.d/samba-ad-dc start >> ;; >> stop) >> >> but I’m not certain that wins.dat is now in tmpfs. >> >> Are my edits correct for what I’m trying to do? >> >> Best regards >> >> David >> >> From: DavidA >> Sent: Tuesday, February 02, 2016 11:00 PM >> To: samba at lists.samba.org >> Subject: A question about Samba logging >> >> Hi >> >> I run the system partition for my Raspberry Pi Samba server off a USB hard >> disk. I want the disk to sleep when not accessed for user data so I want >> log files to live in tmpfs. Currently, if I put the drive in standby >> (using hdparm) it immediately wakes again. I search for files changed >> very recently and see: >> >> $ sudo /usr/local/sbin/ff_changed 1 >> Search whole filesystem for changed files in the last 1 minutes >> /dev/xconsole >> /var/lib/samba >> /var/lib/samba/wins.dat >> /var/lib/sudo/ts/david >> /var/log/auth.log >> >> Is there something I should do to ensure that Samba logs are directed to >> tmpfs? >> >> Best regards >> >> David >> -- >> To unsubscribe from this list go to the following URL and read the >> instructions: https://lists.samba.org/mailman/options/samba > >There is any easier way of dealing with wins.dat, turn off nmbd. This will stop it being created in the first place, but you will not have network browsing. you should probably be aware that wins.dat is not a log file and I don't think that it is your problem anyway. If you do a google search, you will find lots of results about usb drives not wanting to hibernate. Rowland
There can be tons of things blocking the hibernation. If you run a gui for example ( my home kodi for example. ) I need to remove the sound and graphics driver from mem before hibernating. Best i could find. https://wiki.archlinux.org/index.php/Power_management read though it, you might get ideas for you problem. Gr. Louis> -----Oorspronkelijk bericht----- > Van: samba [mailto:samba-bounces at lists.samba.org] Namens Rowland penny > Verzonden: vrijdag 5 februari 2016 11:21 > Aan: samba at lists.samba.org > Onderwerp: Re: [Samba] A question about Samba logging > > On 05/02/16 10:06, L.P.H. van Belle wrote: > > Hai David, > > > > What you want is possible, i would do something like this. > > I've not tested it but read it, its a good pointer howto do this. > > > > Debian used systemd. Close your eyes Rowland.... ;-) > > Im still learning things about systemd, so if some sees things that > needs to be corrected please tell us. > > > > To remember! Files in /etc/tmpfiles.d override files with the same name > > in /usr/lib/tmpfiles.d > > > > so knowing this .. > > cp /usr/lib/tmpfiles.d/samba.conf /etc/tmpfiles.d/samba.conf > > and add to this file > > d /run/samba/varcache 0755 root root - > > d /run/samba/varlib 0755 root root - > > > > This solves the problem of the needed tmpfs folders > > > > > > Now you problely also want to backup the content of these > > when stopping samba and put it back when you start samba. > > This might be bit faultly, and may need corrections. > > > > Create the samba2ram.service folder to add this service file. > > /etc/systemd/system/samba2ram.service > > chmod 664 /etc/systemd/system/samba2ram.service > > add something like this to the service file. > > > > [Unit] > > Description=Samba tmpfs copy/restore to ramdisk > > > > [Service] > > Type=oneshot > > ExecStart=/usr/local/sbin/samba2ramfs.sh > > ExecStop=/usr/local/sbin/samba2ramfs.sh > > Before=samba.service > > RemainAfterExit=yes > > > > [Install] > > WantedBy=multiuser.target > > > > Example very simple copy script. > > /usr/local/sbin/samba2ramfs.sh > > #!/bin/bash > > > > if [ "${1}" = "start" ]; then > > cp -R /var/cache/samba /run/samba/varcache > > cp -R /var/lib/samba /run/samba/varlib > > fi > > > > if [ "${1}" = "stop" ]; then > > cp -R /run/samba/varcache /var/cache/samba > > cp -R /run/samba/varlib /var/lib/samba > > fi > > > > and enable the service. > > systemctl enable samba2ram.service > > test : systemctl start samba2ram.service > > or reboot the system. > > > > > > Greetz, > > > > Louis > > > > > > > > > >> -----Oorspronkelijk bericht----- > >> Van: samba [mailto:samba-bounces at lists.samba.org] Namens DavidA > >> Verzonden: donderdag 4 februari 2016 22:25 > >> Aan: samba at lists.samba.org > >> Onderwerp: Re: [Samba] A question about Samba logging > >> > >> Hi > >> > >> May I ask for help with this again please? > >> > >> I’m trying to ensure that Samba writes its wins.dat file to tmpfs. > >> > >> I have added these mount commands to /etc/init.d/samba: > >> > >> case $1 in > >> start) > >> mount -t tmpfs tmpfs /var/run/samba > >> mount -t tmpfs tmpfs /var/cache/samba > >> /etc/init.d/nmbd start > >> /etc/init.d/smbd start > >> /etc/init.d/samba-ad-dc start > >> ;; > >> stop) > >> > >> but I’m not certain that wins.dat is now in tmpfs. > >> > >> Are my edits correct for what I’m trying to do? > >> > >> Best regards > >> > >> David > >> > >> From: DavidA > >> Sent: Tuesday, February 02, 2016 11:00 PM > >> To: samba at lists.samba.org > >> Subject: A question about Samba logging > >> > >> Hi > >> > >> I run the system partition for my Raspberry Pi Samba server off a USB > hard > >> disk. I want the disk to sleep when not accessed for user data so I > want > >> log files to live in tmpfs. Currently, if I put the drive in standby > >> (using hdparm) it immediately wakes again. I search for files changed > >> very recently and see: > >> > >> $ sudo /usr/local/sbin/ff_changed 1 > >> Search whole filesystem for changed files in the last 1 minutes > >> /dev/xconsole > >> /var/lib/samba > >> /var/lib/samba/wins.dat > >> /var/lib/sudo/ts/david > >> /var/log/auth.log > >> > >> Is there something I should do to ensure that Samba logs are directed > to > >> tmpfs? > >> > >> Best regards > >> > >> David > >> -- > >> To unsubscribe from this list go to the following URL and read the > >> instructions: https://lists.samba.org/mailman/options/samba > > > > > > There is any easier way of dealing with wins.dat, turn off nmbd. This > will stop it being created in the first place, but you will not have > network browsing. > > you should probably be aware that wins.dat is not a log file and I don't > think that it is your problem anyway. If you do a google search, you > will find lots of results about usb drives not wanting to hibernate. > > Rowland > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba