LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-09-2019, 03:32 AM   #1
kaza
Member
 
Registered: Apr 2010
Distribution: FC17
Posts: 343

Rep: Reputation: 2
Can I safely exclude "/run", "/var" from full backup list?


Hello,

I'm currently going over "tar" messages like: "Mod time differs"
or "Contents differ" or "Size differs" created after running
a full backup to tape followed by comparing of the backed up files
with them on the disk.

Many of the differences (I'm only at the begining of the log file)
are in "/run" or "/var" directories. Searching info about
particular files for which the "tar" found differences I see tnat
they're created by the OS so I can excude them from the full backup
list. It would be easier if I just excluded the entire "/run" and "/var"
directories but I hesitate: what if by doing this I'll not backup
something important and if (God forbid) I'll have to recreate my whole system
some missing file from these directories will make the entire restored system
unusable?

Can I safely exclude "/run" and "/var" directories from the full backup list?

If yes, what would be better: to exclude the entire directory like "/run" in the
exclude configuration file or rather "everything below that directory" like: "/run/*" ?
The first option will (I think) remove the "run" directory itself while the second
one will re-create it but leave it empty (I think), preventing problems of OS attempting
to write to non-existant "/run" directory.

Are there other directories (except various "cache" which are already excluded) that I can
safely exclude?

TIA,
kaza.
 
Old 02-09-2019, 04:23 AM   #2
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
I wouldn't exclude /var/ as logs end up there. And downloaded packages for updates. Plus other annoyances if you end up without it. Putting /var on it's own device and backing it up separately might be a better idea. Seems like /run could be excluded though. It wasn't even a thing a decade-ish ago and probably more of a post boot presence thing like /proc /dev /opt and such. But I guess that depends on the distro these days.

$ man hier

Might help better isolate what's what. Oddly /run isn't even listed on that it seems. I'm pretty sure you could exclude /usr/share/doc/ if you need to save a lot of space. No one reads docs anyway. Or not!
 
Old 02-09-2019, 04:26 AM   #3
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
You need to do basic research before asking questions.

I'd suggest you have a read of this.

It clearly states the following:

Quote:
/run - Run-time variable data: Information about the running system since last boot, e.g., currently logged-in users and running daemons. Files under this directory must be either removed or truncated at the beginning of the boot process; but this is not necessary on systems that provide this directory as a temporary filesystem (tmpfs).
Quote:
/var - Variable files—files whose content is expected to continually change during normal operation of the system—such as logs, spool files, and temporary e-mail files.
So what do you think the answer is?
 
Old 02-09-2019, 04:36 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
The short answer is you shouldn't be backing up a running system - especially to a slow device like tape.
I use snapshot to get a consistent point-in-time reference that I can then backup at my leisure. OpenSUSE rely on snapper to do the job, but they allocate a bunch of separate mounts to allow segregation of what needs to be restorable (from a snap) and what doesn't. They used to have an excellent explanation in their admin guide - you'd do well to go read it.

As for the FHS, does anyone actually conform to it ?.
 
Old 02-09-2019, 05:55 AM   #5
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by kaza View Post
Can I safely exclude "/run" and "/var" directories from the full backup list?
As others already mentioned: Do NOT exclude /var as i.e. the complete "installed packages database" (like /var/lib/rpm) is located there so a restored system wouldn't be able anymore to update itself.
Directories like /var/run (mostly PID's of running processes) and /var/tmp of course can be excluded.
And, of course, run the backup when the system is not doing anything else (I do it at 4:50, just after all logfiles have been "rotated" at 4:40).
 
Old 02-09-2019, 03:29 PM   #6
kaza
Member
 
Registered: Apr 2010
Distribution: FC17
Posts: 343

Original Poster
Rep: Reputation: 2
Thanks for all the replies, I'll carefully add to the exclude list few directories
where the files seems like "created automatically" but not the entire "/run" or "/var".

Thanks,
kaza.
 
Old 02-11-2019, 12:16 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by kaza View Post
I'll carefully add to the exclude list few directories where the files seems like "created automatically" but not the entire "/run" or "/var".
That is not what was recommended.
It was very clearly recommended to NOT exclude /var at all.
And I also don't see any sense in backing up any part of /run.
 
Old 02-11-2019, 02:40 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
when you execute the command mount you will see lines like this:
Code:
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8104532k,nr_inodes=2026133,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1627100k,mode=755)
/dev/mapper/ubuntu--vg-root on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
...
lines beginning with tmpfs should not be saved, /proc, /sys, /dev should not be saved.
 
Old 02-11-2019, 08:05 AM   #9
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 243

Rep: Reputation: Disabled
First, DO NOT exclude all of /var! It has your package manager databases, application data, and log files. If you lose your package manager database, your system won't know what packages are installed and what their state is. If you lose your logs, it could be harder to figure out what happened that is causing you to restore from backup. I would exclude your package manager cache. These directories typically grow to several GB.

Some applications that keep data in /var by default on popular distributions:
  • Apache HTTPD
  • PostgreSQL
  • MySQL/MariaDB
  • OpenLDAP
  • Samba

Here are the locations of package manager caches based on OS upstream:
  • RHEL: /var/cache/yum
  • Debian: /var/cache/apt
  • FreeBSD: /var/cache/pkg

I agree with ondoho that it doesn't make any sense to back up run since all that you usually find here are PID files and AF_UNIX socket files that are generated when processes start.

Last edited by tyler2016; 02-11-2019 at 08:17 AM. Reason: Grammar, added agreement with ondoho, forgot about applications
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/var/cache/yum and /var/lib/rpm getting BIG. How to safely pare down? SharpyWarpy Linux - General 3 02-29-2012 01:17 AM
[SOLVED] Partial list with ls-l in bash script run in cron but full list run from command line redgshost Linux - General 29 01-16-2011 12:14 PM
Can we use exclude option in"rm" command to exclude some files/folders? yadav_rk727 Linux - Newbie 1 02-03-2010 10:14 AM
can you apply 2.6.x kernel config to 2.4.x safely/somewhat safely? silex_88 Linux - Software 3 12-09-2005 11:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration