Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts

Tuesday, March 2, 2021

Clean up the output of rsync to get rid of the useless directores with no change.

 

https://stackoverflow.com/questions/8580873/do-not-show-directories-in-rsync-output

cefn@cefn-natty-dell:~$ mkdir rsynctest
cefn@cefn-natty-dell:~$ cd rsynctest/
cefn@cefn-natty-dell:~/rsynctest$ mkdir 1
cefn@cefn-natty-dell:~/rsynctest$ mkdir 2
cefn@cefn-natty-dell:~/rsynctest$ mkdir -p 1/first 1/second
cefn@cefn-natty-dell:~/rsynctest$ touch 1/first/file1
cefn@cefn-natty-dell:~/rsynctest$ touch 1/first/file2
cefn@cefn-natty-dell:~/rsynctest$ touch 1/second/file3
cefn@cefn-natty-dell:~/rsynctest$ touch 1/second/file4

cefn@cefn-natty-dell:~/rsynctest$ rsync -r -v 1/ 2
sending incremental file list
first/
first/file1
first/file2
second/
second/file3
second/file4

sent 294 bytes  received 96 bytes  780.00 bytes/sec
total size is 0  speedup is 0.00


cefn@cefn-natty-dell:~/rsynctest$ rsync -r -v 1/ 2 | grep -E -v '/$'
sending incremental file list
first/file1
first/file2
second/file3
second/file4

sent 294 bytes  received 96 bytes  780.00 bytes/sec
total size is 0  speedup is 0.00

gets rid of the crap

example gets rid of crap.  the n parameter makes it a report instead of moving data.
cd <directory>
rsync -anzv ./misc/* /e13/misc| grep -E -v '/$'

 

 

--30--

Monday, May 6, 2019

ipfire upgrade notes 111 to 121 then to current

ipfire 2.19 111 backup to create ISO is broken.

One needs to patch /usr/local/bin/backupiso to point at a new subdomain.  They changed the subdomain for the downloads from download.ipfire.com to downloads.ipfire.com, and didn't leave the old subdomain for older backups.

the ipf file is created w/o problem, but it's always good to have a testable iso to use before embarking on any big upgrade.

topic on the forum:

Resolving download.ipfire.org fails - 'unknown host'

https://forum.ipfire.org/viewtopic.php?f=27&t=19579&p=111171&hilit=backupiso#p111171



--30--

Saturday, September 24, 2016

Ubuntu / rsync backup


 https://www.digitalocean.com/community/tutorials/how-to-upgrade-ubuntu-12-04-lts-to-ubuntu-14-04-lts

 The aAX flags tell rsync to preserve important file attributes like permissions, ownerships, and modification times. If you are using Docker or another virtualization tool, you should add the S flag so that rsync properly handles sparse files, like virtual storage.

sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} -e 'ssh -i /path/to/private_key' root@SERVER_IP_ADDRESS:/* ~/backup/
 
sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*", \
"/mnt/*","/media/*","/lost+found"} -e 'ssh -i /path/to/private_key' \
root@SERVER_IP_ADDRESS:/* ~/backup/ 

If you need to restore parts of your server files later on, you can use rsync 
again with the source and destination parameters reversed, like so:  
 
sudo rsync -aAXv -e 'ssh -i /path/to/private_key' ~/backup/ root@SERVER_IP_ADDRESS:/*

xx
 
How to deal with "/path/to/private_key" 

http://www.cyberciti.biz/faq/force-ssh-client-to-use-given-private-key-identity-file/

example:

ssh -i /path/to/id_rsa user@server.nixcraft.com
ssh -i /path/to/id_dsa user@server2.nixcraft.net.in

To use /backup/home/user/.ssh/id_dsa, enter:

ssh -i /backup/home/user/.ssh/id_dsa user@unixserver1.nixcraft.com


xx 

Ubuntu / rsync backup


 https://www.digitalocean.com/community/tutorials/how-to-upgrade-ubuntu-12-04-lts-to-ubuntu-14-04-lts

 The aAX flags tell rsync to preserve important file attributes like permissions, ownerships, and modification times. If you are using Docker or another virtualization tool, you should add the S flag so that rsync properly handles sparse files, like virtual storage.

sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} -e 'ssh -i /path/to/private_key' root@SERVER_IP_ADDRESS:/* ~/backup/
 
sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*", \
"/mnt/*","/media/*","/lost+found"} -e 'ssh -i /path/to/private_key' \
root@SERVER_IP_ADDRESS:/* ~/backup/ 

If you need to restore parts of your server files later on, you can use rsync 
again with the source and destination parameters reversed, like so:  
 
sudo rsync -aAXv -e 'ssh -i /path/to/private_key' ~/backup/ root@SERVER_IP_ADDRESS:/*

xx
 
How to deal with "/path/to/private_key" 

http://www.cyberciti.biz/faq/force-ssh-client-to-use-given-private-key-identity-file/

example:

ssh -i /path/to/id_rsa user@server.nixcraft.com
ssh -i /path/to/id_dsa user@server2.nixcraft.net.in

To use /backup/home/user/.ssh/id_dsa, enter:

ssh -i /backup/home/user/.ssh/id_dsa user@unixserver1.nixcraft.com


xx 

Sunday, May 22, 2016

Transfering SQL database between two linux servers

Process for moving a database between two linux servers running mysql.

Target server may or may not have the database created.  example used uses phpmydmin create database to create the empty database.

Use mysqldump to create an ".sql" file with the data from the database.  Example here is for an RSS reader application, and keeps track of the rss feeds for doing deltas for the read presentation.

Note for sql the password and user id are for the mysql users and the password on the mysql server.  They are not linux account passwords.  The commands can be performed from any userid with access to the mysql commands, since the database is worked via the mysqldump command to the mysql socket.  Access to the actual files is not required, since the work is done on those files by the mysql server.

backup:

 mysqldump --password=<some-password> -u <userid> rss > 2016-0522-rss-mysqldump.sql

create database in phpmyadmin: 

Databases->Create new Database [enter rss in name field] (Create)

restore:

mysql -u <userid> --password=<password> rss < 2016-0522-rss-mysqldump.sql


Friday, March 18, 2016

restoring time machine images for other macs


Problem is to access all the time machine backups on a network drive.  A lot of the hints and scenarios involve taking a timemachine backup drive and essentially doing a "sneaker net" or moving the physical drive.

The setup here which is more desirable is all machines in the house completely backed up to a single time capsule, which is a Readynas with Time Machine backup turned on.

Here is a hint relating to installing a new disk in a drive and convincing a time machine setup to skip to the old images for the same machine.

*******

Keyboard secret handshake.

hint, to find the rumoured option to browse other disks, use the option key when clicking the time machine symbol.  It's not in the dock, it is in the top display bar (as usual).


********
http://apple.stackexchange.com/questions/163436/how-can-i-retrieve-files-from-a-time-machine-backup-done-with-snow-leopard-when


I have a Seagate GoFlex home 2 Tb external drive that was installed on my Snow Leopard Mac and configurer with Time Machine. A year ago, due to issues with my Mac, the (internal) hard drive was erased and I subsequently installed Mavericks and re-configured Time Machine with the external drive. I would like to retrieve the files from the Snow Leopard backups, which included many photos for example but I am unable to see them in Time Machine. I can only see the Mavericks backups. Here are additional things I tried:
  • I tried accessing the external drive via Finder but nothing appears in the Time Machine backup folder. I obviously also looked in the other folders and for hidden files but nothing relevant appears.
  • I looked at the Seagate GoFlex applications that were included with the drive but none of them allow me to access the backups, including the Mavericks backups.
  • I tried the Migration Assistant (under Utilities) and I can only see the Mavericks backups.
  • I checked my Time Machine settings and "tell me when old backups are deleted" is enabled. I would have been noticed (which isn't the case). I also read that new backups can override older ones but my disk still has 1.5 Tb free.


The Time Machine backup format is OS-version agnostic. It doesn't care which version of the OS created the backup or which version is trying to access it.
It does care which machine is accessing the data. As far as TM is concerned, erasing your internal drive turned it into a "new" disk volume. The stuff it backed up before the erasure and the stuff it backed up after the erasure are backups of different disks and have nothing whatsoever to do with each other. That's why when you're browsing the backup of your current disk you can't see further back than when it was created.
This can be fixed, but only if you are mistaken when you say I tried accessing the external drive via Finder but nothing appears in the Time Machine backup folder. This can't be right. Your Mavericks backups, which you say exist, should show up in Finder.
If you look on your backup volume, you should see a folder named Backups.backupdb. Inside that is a folder for every computer you are backing up there. I'll assume there's only one. Inside that folder are a bunch of folders, almost all of them snapshots named according to when they were taken, in the format YYYY-MM-DD-HHMMSS. There will also be an alias name "Later" and maybe a few other folders. If that isn't what you see, I don't know how to help you.
Open TM and see how far back in time you can go. Make a note of that date and time. Exit Time Machine.
In Finder, browse through the list of snapshots to find the latest one from before that oldest Mavericks backup. That was the last snapshot taken from before you erased the disk. If there isn't one, if the oldest snapshot is one you can reach with Time Machine, you're out of luck. You must have erased your TM backup when you set up TM to start backing up the new disk, and your old data is gone.
But if you can find such a pre-erasure snapshot, we can re-associate it with the new disk. That is, we can make TM treat it as a backup of your current boot disk.
To do that, log into your admin account and open Terminal (in /Applications/Utilities). Enter the command
sudo tmutil associatedisk -a / 
but don't press return yet. Be sure you left a space after the slash. Open up that pre-erasure snapshot, and you will see a folder for each disk you were backing up at that time. (There's probably only one: your boot volume. That's the one we want.) Drag that folder (the one for the snapshot of your boot volume) to the Terminal window. Drop it anywhere; Terminal will put it in the right place.
Press return. If you've never used sudo before, you'll get a scary warning message, which you should read but ignore. You'll be prompted for your admin password, which you need to type blind. Nothing will be echoed to the screen. Press return at the end of the password.
Time Machine should now be able to browse backwards across the erasure.