LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   simple way to back up a folder (https://www.linuxquestions.org/questions/slackware-14/simple-way-to-back-up-a-folder-4175735735/)

hedron 04-06-2024 09:06 AM

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.

wpeckham 04-06-2024 09:29 AM

Just to satisfy my curiosity, what is wrong with using a real backup program?

hedron 04-06-2024 09:37 AM

Quote:

Originally Posted by wpeckham (Post 6494429)
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.

gauchao 04-06-2024 09:39 AM

rsync -av --delete /source/ /target/

Windu 04-06-2024 09:54 AM

Perhaps this will give you some inspiration for incremental backups using rsync and hardlinks: https://wiki.alienbase.nl/doku.php?id=linux:rsnapshot

philanc 04-06-2024 10:32 AM

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.

jailbait 04-06-2024 12:38 PM

Quote:

Originally Posted by hedron (Post 6494424)
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.

jayjwa 04-06-2024 02:11 PM

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.

henca 04-06-2024 03:01 PM

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

hpfeil 04-06-2024 03:46 PM

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.

wpeckham 04-06-2024 06:17 PM

https://www.tecmint.com/linux-system-backup-tools/ provides a list of the best 23, but not the other 104.

rkelsen 04-07-2024 01:05 AM

Quote:

Originally Posted by hedron (Post 6494424)
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.

Mark Pettit 04-07-2024 01:45 AM

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.

GazL 04-07-2024 04:37 AM

Quote:

Originally Posted by Mark Pettit (Post 6494577)
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.

Ilgar 04-07-2024 07:33 AM

Quote:

Originally Posted by hedron (Post 6494431)
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.


All times are GMT -5. The time now is 03:24 PM.