Difference between revisions of "Network backup"
m (typo) |
|||
Line 36: | Line 36: | ||
Rysnc is a more efficient protocol to use than scp. It will ensure file permissions and ownerships are preserved and will compress data on the fly to make for a faster transfer. (it will also only copy the needed files so if you add files, then you can run the command again and rsync will only copy the additional files. You can also remove files and use the --delete option and it will remove the files on the remote host). | Rysnc is a more efficient protocol to use than scp. It will ensure file permissions and ownerships are preserved and will compress data on the fly to make for a faster transfer. (it will also only copy the needed files so if you add files, then you can run the command again and rsync will only copy the additional files. You can also remove files and use the --delete option and it will remove the files on the remote host). | ||
− | If you don't want to copy hidden files add <code>--exclude=".*/"</code> as an option. Its a good idea to at least copy over users .mozilla files, and any .evolution or .thunderbird folders as a minimum. It shouldn't | + | If you don't want to copy hidden files add <code>--exclude=".*/"</code> as an option. Its a good idea to at least copy over users .mozilla files, and any .evolution or .thunderbird folders as a minimum. It shouldn't cause too many problems copying over all hidden files. |
If you have reinstalled and the user had accounts other then oem you will still need to recreate those user accounts: | If you have reinstalled and the user had accounts other then oem you will still need to recreate those user accounts: |
Revision as of 14:42, 5 March 2011
You will need to be on a wired connection for this to work
To backup a persons home folder(s) over the network using rsync (as root).
rsync -avzh home/ tsbackup@tsbackup:/var/tsbackup/[date-ticketnumber]
use ISO (reverse) format for the date e.g. 20121223 for Dec 23 2012.
To copy it back again:
rsync -avzh tsbackup@tsbackup:/var/tsbackup/[date-ticketnumber]/ home
N.B. The trailing slash on the source (first part) is important in rsync. A trailing slash means copy the contents of this folder without creating the folder itself. If you are uncertain about anything you can test it using the -n
option. This will do a dry run and nothing will actually be copied over. It is a good habit to do a sanity check first with rsync; it is an immensly powerful tool and you want to make sure it is going to do what you think it is.
Rysnc is a more efficient protocol to use than scp. It will ensure file permissions and ownerships are preserved and will compress data on the fly to make for a faster transfer. (it will also only copy the needed files so if you add files, then you can run the command again and rsync will only copy the additional files. You can also remove files and use the --delete option and it will remove the files on the remote host).
If you don't want to copy hidden files add --exclude=".*/"
as an option. Its a good idea to at least copy over users .mozilla files, and any .evolution or .thunderbird folders as a minimum. It shouldn't casue too many problems copying over all hidden files.
If you have reinstalled and the user had accounts other then oem you will still need to recreate those user accounts:
adduser [username]
You will need to be on a wired connection for this to work
To backup a persons home folder(s) over the network using rsync (as root).
rsync -avzh home/ tsbackup@tsbackup:/var/tsbackup/[date-ticketnumber]
use ISO (reverse) format for the date e.g. 20121223 for Dec 23 2012.
To copy it back again:
rsync -avzh tsbackup@tsbackup:/var/tsbackup/[date-ticketnumber]/ home
N.B. The trailing slash on the source (first part) is important in rsync. A trailing slash means copy the contents of this folder without creating the folder itself. If you are uncertain about anything you can test it using the -n
option. This will do a dry run and nothing will actually be copied over. It is a good habit to do a sanity check first with rsync; it is an immensly powerful tool and you want to make sure it is going to do what you think it is.
Rysnc is a more efficient protocol to use than scp. It will ensure file permissions and ownerships are preserved and will compress data on the fly to make for a faster transfer. (it will also only copy the needed files so if you add files, then you can run the command again and rsync will only copy the additional files. You can also remove files and use the --delete option and it will remove the files on the remote host).
If you don't want to copy hidden files add --exclude=".*/"
as an option. Its a good idea to at least copy over users .mozilla files, and any .evolution or .thunderbird folders as a minimum. It shouldn't cause too many problems copying over all hidden files.
If you have reinstalled and the user had accounts other then oem you will still need to recreate those user accounts:
adduser [username]
You might need to change the ownership to match that of the user if find the ownership and groups had change to a numeric value (check using ls -lh
.
find /home/username/ -type f -exec chown -R username.username {} \;
or just
chown -R username.username /home/username/
You might also need to apply proper permissions. This step should be unnecessary with rsync as it will preserve permissions. However you might find the ownership and groups had change to a numeric value (check using ls -lh
. If this is the case you need only to run the first line.
find /home/username/ -type f -exec chmod 644 {} \; find /home/username/ -type d -exec chmod 754 {} \;
or for move private users
find ./ -type f -exec chmod 640 {} \; find ./ -type d -exec chmod 750 {} \;
When you are finished with a backup and sure that all the data is properly transfered remove it from Cactus2. Do we really want to immediately delete the data? I'm not sure this is best. Luiz 22:33, 28 October 2010 (UTC)
rm -r /var/tsbackup/[date-name]