LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-06-2024, 09:06 AM   #1
hedron
Member
 
Registered: Jul 2009
Location: NYC
Distribution: Slackware64-multilib 15.0, SARPI, artix
Posts: 401

Rep: Reputation: 32
simple way to back up a folder


What's a good way to back up a folder?

Looking to make monthly backups.

Simply doing this:
Code:
cp -r /path/to/folder/* /backup/folder/
Works good for one time. But then you don't want to back up all the stuff everytime, as it takes quite a while.

Then there's the problem of monitoring every folder in case I move a folder. So, cp -r isn't going to work.

Another solution is to have two backup hard drives, and cp -r onto alternating drives every month.

It's gigabytes of data, and most of it is already is compressed format. So, tar and similar commands only increase the amount of time required.
 
Old 04-06-2024, 09:29 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
Just to satisfy my curiosity, what is wrong with using a real backup program?
 
Old 04-06-2024, 09:37 AM   #3
hedron
Member
 
Registered: Jul 2009
Location: NYC
Distribution: Slackware64-multilib 15.0, SARPI, artix
Posts: 401

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by wpeckham View Post
Just to satisfy my curiosity, what is wrong with using a real backup program?
Nothing. I just don't know of one for linux. I've seen a few for windows, but they were all proprietary and you couldn't access your data without the program.
 
Old 04-06-2024, 09:39 AM   #4
gauchao
Member
 
Registered: Dec 2009
Location: Veneto
Distribution: Slackware64
Posts: 366

Rep: Reputation: 143Reputation: 143
rsync -av --delete /source/ /target/
 
4 members found this post helpful.
Old 04-06-2024, 09:54 AM   #5
Windu
Member
 
Registered: Aug 2021
Distribution: Arch Linux, Debian, Slackware
Posts: 591

Rep: Reputation: Disabled
Perhaps this will give you some inspiration for incremental backups using rsync and hardlinks: https://wiki.alienbase.nl/doku.php?id=linux:rsnapshot
 
3 members found this post helpful.
Old 04-06-2024, 10:32 AM   #6
philanc
Member
 
Registered: Jan 2011
Posts: 308

Rep: Reputation: 273Reputation: 273Reputation: 273
I suggest `restic`. Very happy with it. Incremental backup is amazingly fast!

For Slackware, see
http://slackbuilds.org/repository/15...?search=restic

You can find a quick start intro and plenty of documentation at https://restic.net/

I should add that backups are fully encrypted. So no confidentiality risk if you backup to a removable USB stick or hard disk.

Last edited by philanc; 04-06-2024 at 10:50 AM. Reason: added note about encryption
 
2 members found this post helpful.
Old 04-06-2024, 12:38 PM   #7
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,340

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by hedron View Post
Another solution is to have two backup hard drives, and cp -r onto alternating drives every month.
If you have enough space to create two partitions each on your two backup drives then I would recommend that you use one of the drives for off site backup. You could alternate partitions on each drive each month.

Also you would not have to do both onsite and offsite backups on the same day. You could stagger them two weeks apart.

Last edited by jailbait; 04-09-2024 at 10:18 AM.
 
1 members found this post helpful.
Old 04-06-2024, 02:11 PM   #8
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 786

Rep: Reputation: 250Reputation: 250Reputation: 250
tar has an option to update only changed files. 7zip and others have a "only add if changed" option as well. Some don't support permissions and users/groups saving so consider that. cpio. rsync.
 
1 members found this post helpful.
Old 04-06-2024, 03:01 PM   #9
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 978

Rep: Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667Reputation: 667
Creating something like a new tar file for every backup has the advantage that you will have different backups with different ages. If you accidentally break something in the original source and make a new backup you will at least still have some older backup backup laying around.

The same can be accomplished also with rsync to a single directory structure if the target directory structure resides on a file system with some kind of snapshot functionality.

Whenever someone is considering different backup solutions I usually point to this good old set of pages with things to consider: http://www.taobackup.com/

regards Henrik
 
2 members found this post helpful.
Old 04-06-2024, 03:46 PM   #10
hpfeil
Member
 
Registered: Nov 2010
Location: Tucson, Arizona US
Distribution: Slackware Current
Posts: 355
Blog Entries: 1

Rep: Reputation: Disabled
rsync mo better

Code:
rsync -av --progress /path/to/folder/* /backup/folder/
Rsync simpler, easier to remember.
I sometimes `alias backup='rsync -av --progress to ease the wear and tear of the old fingerbones. Incremental built in. I use cp for monthly image backups, rsync for daily and weeklies.
 
3 members found this post helpful.
Old 04-06-2024, 06:17 PM   #11
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,674

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
https://www.tecmint.com/linux-system-backup-tools/ provides a list of the best 23, but not the other 104.
 
Old 04-07-2024, 01:05 AM   #12
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,462
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by hedron View Post
Looking to make monthly backups.
If you don't want file versioning, then you can use rsync as suggested above.

If you want file versioning, then I can recommend rsnapshot: https://rsnapshot.org/. It's simple and robust, and hasn't disappointed me once since I started using it. It optimises space usage by using a combination of rsync, hard links and deltas. For example: I have a 62Gb data set, for which I started using rsnapshot almost 2 years ago. At this point I have 7 daily, 4 weekly, 12 monthly and 1 annual backups in 77Gb of hard drive space.
 
3 members found this post helpful.
Old 04-07-2024, 01:45 AM   #13
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 15.0
Posts: 619

Rep: Reputation: 299Reputation: 299Reputation: 299
export bkpdate="`date +%y%m%d'_'%H%M%S`"
cd the_dir_to_backup
tar -zcvf * backup_${bkpdate}.tar.gz


Copy resulting file to some other media. A backup kept on the same media is worth nothing.
 
2 members found this post helpful.
Old 04-07-2024, 04:37 AM   #14
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,901

Rep: Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025
Quote:
Originally Posted by Mark Pettit View Post
export bkpdate="`date +%y%m%d'_'%H%M%S`"
cd the_dir_to_backup
tar -zcvf * backup_${bkpdate}.tar.gz
Misformed command: the wildcard is in the wrong place. Should be after the archive file. Also, use of "*" won't include any dot files.


There are lots of ways of using tar, but I prefer:
tar -cvf /backups/wibble.bkp.tar -C /somewhere/wibble .


Use of -C and '.' makes it easier to restore to an alternate location while still using absolute paths on the command-line.


For "archival backups" I use gnu tar listed-incrementals. For disaster recovery (i.e. latest point in time snapshot) backups I use rsync.

I don't like to use any backup tools that will need installing before I can restore from them. By sticking with tar and rsync I know they will already be present.
 
4 members found this post helpful.
Old 04-07-2024, 07:33 AM   #15
Ilgar
Senior Member
 
Registered: Jan 2005
Location: Istanbul, Turkey
Distribution: Slackware64 15.0, Slackwarearm 14.2
Posts: 1,157

Rep: Reputation: 237Reputation: 237Reputation: 237
Quote:
Originally Posted by hedron View Post
Nothing. I just don't know of one for linux. I've seen a few for windows, but they were all proprietary and you couldn't access your data without the program.
I have been using luckyBackup for the last several years and I am quite happy with it. It is basically a GUI front-end for rsync. Available at slackbuilds.org, too.
 
3 members found this post helpful.
  


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
Simple way to get root view of folder? greenace92 Linux - Newbie 7 01-14-2016 07:18 AM
[SOLVED] Better way to create a folder for each month, with another folder inside of each anon091 Linux - Newbie 9 12-03-2012 10:38 AM
Simple Slackware vs simple Arch vs simple Frugalware punchy71 Linux - Distributions 2 08-28-2012 02:30 PM
A script within a folder to delete the folder, script, and the folder's contents Cyberman Programming 15 10-17-2007 07:32 AM
Back button to Go Back? javamdk Linux - Newbie 2 07-08-2004 11:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:29 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