Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 1106  / 2 Years ago, tue, july 19, 2022, 4:53:08

I have a /home/jbruni folder in a VPS running Ubuntu Server 10.04 LTS (Lucid Lynx).



I am about to turn this VPS off and move some things from it to a new VPS, also running the same Ubuntu version.



At the moment, I want to move all contents at /home/jbruni from the "old" VPS to the new one.



1) I want to preserve all file permission and ownership settings (I don't want to use any chown or chmod after the transfer). [Note: the new VPS already have the same users/groups with same UIDs/GIDs.]



2) I want to preserve all symlinks and hardlinks, although I believe there is not a single hardlink in this case. I have lots of symlinks, both for files and for folders, all pointing to locations inside the own /home/jbruni folder.



3) I'd really like to preserve date and times (mtime, atime, ctime). [If not possible, ok... it is not that bad.]



4) I don't have enough disk space to create a big file containing everything in the "old" VPS prior to transfering it (like a big tarball). Anyway, I may acquire this temporary extra space if really really needed.



So, what I want is like a "mirror" of the source folder. Is there a way to accomplish this easily? (Or even not so easily?)



Thank you!


More From » server

 Answers
5

rsync!


rsync -azv -e ssh ./localdirectory/ user@otherserver:/remote/dir

-a is the bad-boy here. It's actually a metaargument that calls -rlptgoD which means, amongst other things:



  • Recursive

  • Preserve symlinks

  • Preserve permissions

  • Preserve modification times

  • Preserve group

  • Preserve owner

  • And preserves special stuff


It won't preserve hardlinks because hardlinks are files (well it's actually a pointer to an inode that stores a filename - but that's what a regular file is too - when you make a hardlink you're just giving an inode an extra filename). This shouldn't be an issue for you because they're quite rare IMO.


-z will attempt to compress the data in the stream (speed things up a bit).


-v will make sure it's giving you plenty of output.


[#42900] Tuesday, July 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
repend

Total Points: 195
Total Questions: 113
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
3 Years ago
repend questions
Thu, May 11, 23, 09:38, 1 Year ago
Thu, Jan 5, 23, 21:41, 1 Year ago
Mon, Nov 22, 21, 19:37, 2 Years ago
Mon, Jan 24, 22, 11:26, 2 Years ago
;