{"id":3154,"date":"2023-11-23T12:28:26","date_gmt":"2023-11-23T05:28:26","guid":{"rendered":"https:\/\/longvan.net\/cong-dong\/?p=3154"},"modified":"2024-04-07T18:58:05","modified_gmt":"2024-04-07T11:58:05","slug":"huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux","status":"publish","type":"post","link":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync &#8211; command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux"},"content":{"rendered":"<h2 style=\"font-family: inherit; font-weight: bold; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #def0ff;\"><span style=\"color: #1e73be;\"> I. L\u1ec7nh Rsync&nbsp; <\/span><\/h2>\n<p><span style=\"font-weight: bold;\">Rsync (Remote Sync) l<\/span>\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn \u0111\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 h\u00f3a c\u00e1c t\u1ec7p, th\u01b0 m\u1ee5c t\u1eeb xa c\u0169ng nh\u01b0 c\u1ee5c b\u1ed9 trong c\u00e1c h\u1ec7 th\u1ed1ng Linux\/Unix.<br \/>\nV\u1edbi s\u1ef1 tr\u1ee3 gi\u00fap c\u1ee7a l\u1ec7nh <span style=\"font-weight: bold;\">rsync<\/span>, c\u00f3 th\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u t\u1eeb xa v\u00e0 n\u1ed9i b\u1ed9 tr\u00ean c\u00e1c th\u01b0 m\u1ee5c, \u1ed5 \u0111\u0129a v\u00e0 m\u1ea1ng, th\u1ef1c hi\u1ec7n sao l\u01b0u d\u1eef li\u1ec7u v\u00e0 nh\u00e2n b\u1ea3n gi\u1eefa hai m\u00e1y ch\u1ee7 Linux.<\/p>\n<p><span style=\"font-weight: bold;\">C\u00fa ph\u00e1p l\u1ec7nh Rsync<\/span><\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\">rsync [options] source destination <\/span><\/code><\/pre>\n<p>c\u00e1c t\u00f9y ch\u1ecdn d\u00f9ng v\u1edbi l\u1ec7nh <b>rsync<\/b><br \/>\n<span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -v<\/span> verbose output, hi\u1ec3n th\u1ecb th\u00f4ng tin chi ti\u1ebft v\u1ec1 qu\u00e1 tr\u00ecnh x\u1eed l\u00ed chuy\u1ec3n d\u1eef li\u1ec7u.<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -r<\/span> sao ch\u00e9p d\u1eef li\u1ec7u theo c\u00e1ch \u0111\u1ec7 quy, kh\u00f4ng l\u01b0u gi\u1eef d\u1ea5u th\u1eddi gian v\u00e0 quy\u1ec1n trong khi chuy\u1ec3n d\u1eef li\u1ec7u.<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -a<\/span> ch\u1ebf \u0111\u1ed9 l\u01b0u tr\u1eef, sao ch\u00e9p t\u1ec7p \u0111\u1ec7 quy v\u00e0 duy tr\u00ec c\u00e1c li\u00ean k\u1ebft t\u01b0\u1ee3ng tr\u01b0ng, quy\u1ec1n truy c\u1eadp t\u1ec7p, quy\u1ec1n s\u1edf h\u1eefu c\u1ee7a ng\u01b0\u1eddi d\u00f9ng v\u00e0 nh\u00f3m c\u0169ng nh\u01b0 d\u1ea5u th\u1eddi gian.<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -z<\/span> n\u00e9n t\u1ec7p trong khi chuy\u1ec3n \u0111\u1ec3 gi\u1ea3m m\u1ee9c s\u1eed d\u1ee5ng m\u1ea1ng.<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -h<\/span> ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 \u0111\u1ecdc, in ra s\u1ed1 \u1edf \u0111\u1ecbnh d\u1ea1ng ng\u01b0\u1eddi c\u00f3 th\u1ec3 \u0111\u1ecdc \u0111\u01b0\u1ee3c<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -P<\/span> hi\u1ec3n th\u1ecb ti\u1ebfn \u0111\u1ed9 trong qu\u00e1 tr\u00ecnh chuy\u1ec3n<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> SOURCE<\/span> ch\u1ec9 \u0111\u1ecbnh (c\u00e1c) t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c ngu\u1ed3n s\u1ebd \u0111\u01b0\u1ee3c chuy\u1ec3n, c\u00f3 th\u1ec3 l\u00e0 v\u1ecb tr\u00ed c\u1ee5c b\u1ed9 ho\u1eb7c v\u1ecb tr\u00ed t\u1eeb xa.<\/p>\n<p><span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> DESTINATION<\/span> ch\u1ec9 \u0111\u1ecbnh \u0111\u01b0\u1eddng d\u1eabn \u0111\u00edch n\u01a1i c\u00e1c t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c s\u1ebd \u0111\u01b0\u1ee3c sao ch\u00e9p. T\u01b0\u01a1ng t\u01b0 nh\u01b0 <span style=\"font-weight: bold;\">Source<\/span>, n\u00f3 c\u00f3 th\u1ec3 l\u00e0 \u0111\u01b0\u1eddng d\u1eabn c\u1ee5c b\u1ed9<\/p>\n<h2 style=\"font-family: inherit; font-weight: bold; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #def0ff;\"><span style=\"color: #1e73be;\"> II. C\u00e0i \u0111\u1eb7t Rsync tr\u00ean Linux <\/span><\/h2>\n<p>Ch\u00fang ta c\u00f3 th\u1ec3 c\u00e0i \u0111\u1eb7t <span style=\"font-weight: bold;\">rsync<\/span> v\u1edbi tr\u00ecnh c\u00e0i \u0111\u1eb7t m\u1eb7c \u0111\u1ecbnh theo c\u1ee7a t\u1eebng h\u1ec7 \u0111i\u1ec1u h\u00e0nh.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\">$ sudo apt install rsync         [tr\u00ean <span style=\"font-weight: bold;\">Debian, Ubuntu<\/span> v\u00e0 <span style=\"font-weight: bold;\">Mint <\/span>]\n$ sudo yum install rsync         [tr\u00ean <span style=\"font-weight: bold;\">RHEL\/CentOS\/Fedora<\/span> v\u00e0 <span style=\"font-weight: bold;\">Rocky\/AlmaLinux<\/span>]\n$ sudo emerge -a sys-apps\/rsync  [tr\u00ean <span style=\"font-weight: bold;\">Gentoo Linux<\/span>]\n$ sudo apk add rsync             [tr\u00ean <span style=\"font-weight: bold;\">Alpine Linux<\/span>]\n$ sudo pacman -S rsync           [tr\u00ean <span style=\"font-weight: bold;\">Arch Linux<\/span>]\n$ sudo zypper install rsync      [tr\u00ean <span style=\"font-weight: bold;\">OpenSUSE<\/span>]<\/span><\/code><\/pre>\n<h2 style=\"font-family: inherit; font-weight: bold; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #def0ff;\"><span style=\"color: #1e73be;\">III. M\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng l\u1ec7nh Rsync<br \/>\n<\/span><\/h2>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">1. Sao ch\u00e9p\/\u0111\u1ed3ng b\u1ed9 t\u1ec7p c\u1ee5c b\u1ed9<\/h3>\n<p>\u0110\u1ec3 sao ch\u00e9p ho\u1eb7c \u0111\u1ed3ng b\u1ed9 h\u00f3a t\u1ec7p c\u1ee5c b\u1ed9, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh sau \u0111\u1ec3 \u0111\u1ed3ng b\u1ed9 h\u00f3a t\u1ec7p tr\u00ean m\u00e1y c\u1ee5c b\u1ed9 t\u1eeb v\u1ecb tr\u00ed n\u00e0y sang v\u1ecb tr\u00ed kh\u00e1c.<\/p>\n<p>V\u00ed d\u1ee5 t\u00ean t\u1ec7p <span style=\"font-weight: bold;\">source-backup.tar<\/span> c\u1ea7n sao ch\u00e9p ho\u1eb7c \u0111\u1ed3ng b\u1ed9 v\u00e0o th\u01b0 m\u1ee5c <span style=\"font-weight: bold;\">\/tmp\/backups<\/span>.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\">[root@longvan]# rsync -zvh source-backup.tar.gz \/tmp\/backups\/\n\ncreated directory \/tmp\/backups\nbackup.tar.gz\n\nsent 448.54K bytes  received 70 bytes  889.21K bytes\/sec\ntotal size is 448.40K  speedup is 1.00<\/span>\n<\/code><\/pre>\n<p>Nh\u01b0 v\u00ed v\u1ee5 tr\u00ean, c\u00f3 th\u1ec3 th\u1ea5y r\u1eb1ng n\u00e0y n\u1ebfu th\u01b0 m\u1ee5c \u0111\u1ebfn ch\u01b0a t\u1ed3n t\u1ea1i th\u00ec rsync t\u1ef1 \u0111\u1ed9ng t\u1ea1o m\u1ed9t th\u01b0 m\u1ee5c.<\/p>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">2. Sao ch\u00e9p\/\u0111\u1ed3ng b\u1ed9 th\u01b0 m\u1ee5c c\u1ee5c b\u1ed9<\/h3>\n<p>L\u1ec7nh b\u00ean d\u01b0\u1edbi s\u1ebd chuy\u1ec3n ho\u1eb7c \u0111\u1ed3ng b\u1ed9 t\u1ea5t c\u1ea3 t\u1ec7p t\u1eeb th\u01b0 m\u1ee5c n\u00e0y sang th\u01b0 m\u1ee5c kh\u00e1c trong c\u00f9ng m\u1ed9t m\u00e1y ch\u1ee7.<\/p>\n<p>Trong v\u00ed d\u1ee5 n\u00e0y, <span style=\"font-weight: bold;\">\/root\/rpmpkgs<\/span> ch\u1ee9a c\u00e1c t\u1ec7p rpm package v\u00e0 \u1edf \u0111\u00e2y s\u1ebd th\u01b0 m\u1ee5c n\u00e0y \u0111\u01b0\u1ee3c sao ch\u00e9p v\u00e0o b\u00ean trong th\u01b0 m\u1ee5c <span style=\"font-weight: bold;\">\/tmp\/backups\/<\/span>.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\">[root@longvan]# rsync -avzh \/root\/rpmpkgs \/tmp\/backups\/\n\nsending incremental file list\nrpmpkgs\/\nrpmpkgs\/httpd-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\nrpmpkgs\/mod_ssl-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\nrpmpkgs\/nagios-4.4.6-4.el8.x86_64.rpm\nrpmpkgs\/nagios-plugins-2.3.3-5.el8.x86_64.rpm\n\nsent 3.47M bytes  received 96 bytes  2.32M bytes\/sec\ntotal size is 3.74M  speedup is 1.08\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">3. Sao ch\u00e9p th\u01b0 m\u1ee5c t\u1eeb m\u00e1y ch\u1ee7 c\u1ee5c b\u1ed9 sang m\u00e1y ch\u1ee7 t\u1eeb xa<\/h3>\n<p>\u0110\u1ec3 sao ch\u00e9p m\u1ed9t th\u01b0 m\u1ee5c t\u1eeb m\u00e1y ch\u1ee7 c\u1ee5c b\u1ed9 sang m\u00e1y ch\u1ee7 t\u1eeb xa, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh sau \u0111\u1ec3 \u0111\u1ed3ng b\u1ed9 h\u00f3a th\u01b0 m\u1ee5c t\u1eeb m\u00e1y c\u1ee5c b\u1ed9 sang m\u00e1y t\u1eeb xa.<\/p>\n<p>V\u00ed d\u1ee5: n\u1ebfu c\u00f3 m\u1ed9t th\u01b0 m\u1ee5c trong m\u00e1y t\u00ednh c\u1ee5c b\u1ed9 c\u1ee7a b\u1ea1n &#8220;rpmpkgs&#8221; ch\u1ee9a c\u00e1c RPM packages v\u00e0 b\u1ea1n mu\u1ed1n n\u1ed9i dung c\u1ee7a th\u01b0 m\u1ee5c c\u1ee5c b\u1ed9 \u0111\u00f3 g\u1eedi \u0111\u1ebfn m\u00e1y ch\u1ee7 t\u1eeb xa, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh sau.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"># rsync -avzh \/root\/rpmpkgs root@192.168.1.123:\/root\/\n\nThe authenticity of host '192.168.1.123 (192.168.1.123)' can't be established.\nED25519 key fingerprint is SHA256:bH2tiWQn4S5o6qmZhmtXcBROV5TU5H4t2C42QDEMx1c.\nThis key is not known by any other names\nAre you sure you want to continue connecting (yes\/no\/[fingerprint])? yes\nWarning: Permanently added '192.168.1.123' (ED25519) to the list of known hosts.\nroot@192.168.1.123's password: \nsending incremental file list\nrpmpkgs\/\nrpmpkgs\/httpd-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\nrpmpkgs\/mod_ssl-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\nrpmpkgs\/nagios-4.4.6-4.el8.x86_64.rpm\nrpmpkgs\/nagios-plugins-2.3.3-5.el8.x86_64.rpm\n\nsent 3.74M bytes  received 96 bytes  439.88K bytes\/sec\ntotal size is 3.74M  speedup is 1.00\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">4. Sao ch\u00e9p th\u01b0 m\u1ee5c t\u1eeb xa sang m\u00e1y ch\u1ee7 c\u1ee5c b\u1ed9<\/h3>\n<p>L\u1ec7nh n\u00e0y s\u1ebd gi\u00fap b\u1ea1n \u0111\u1ed3ng b\u1ed9 th\u01b0 m\u1ee5c t\u1eeb xa v\u1edbi th\u01b0 m\u1ee5c c\u1ee5c b\u1ed9. \u1ede \u0111\u00e2y th\u01b0 m\u1ee5c <span style=\"font-weight: bold;\">\/root\/rpmpkgs<\/span> tr\u00ean m\u00e1y ch\u1ee7 t\u1eeb xa \u0111ang \u0111\u01b0\u1ee3c sao ch\u00e9p v\u00e0o m\u00e1y t\u00ednh c\u1ee5c b\u1ed9 c\u1ee7a b\u1ea1n trong <span style=\"font-weight: bold;\">\/tmp\/myrpms<\/span>.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avzh root@192.168.1.123:\/root\/rpmpkgs \/tmp\/myrpms\n\nroot@192.168.1.123's password: \nreceiving incremental file list\ncreated directory \/tmp\/myrpms\nrpmpkgs\/\nrpmpkgs\/httpd-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\nrpmpkgs\/mod_ssl-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\nrpmpkgs\/nagios-4.4.6-4.el8.x86_64.rpm\nrpmpkgs\/nagios-plugins-2.3.3-5.el8.x86_64.rpm\n\nsent 104 bytes  received 3.49M bytes  997.68K bytes\/sec\ntotal size is 3.74M  speedup is 1.07<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">5. Rsync qua SSH<\/h3>\n<p>V\u1edbi rsync, c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng <span style=\"font-weight: bold;\">SSH (Secure Shell)<\/span> \u0111\u1ec3 truy\u1ec1n d\u1eef li\u1ec7u, s\u1eed d\u1ee5ng giao th\u1ee9c SSH trong khi truy\u1ec1n d\u1eef li\u1ec7u, c\u00f3 th\u1ec3 \u0111\u1ea3m b\u1ea3o r\u1eb1ng d\u1eef li\u1ec7u c\u1ee7a m\u00ecnh \u0111ang \u0111\u01b0\u1ee3c truy\u1ec1n trong m\u1ed9t k\u1ebft n\u1ed1i b\u1ea3o m\u1eadt b\u1eb1ng m\u00e3 h\u00f3a \u0111\u1ec3 kh\u00f4ng ai c\u00f3 th\u1ec3 \u0111\u1ecdc d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n trong khi n\u00f3 \u0111ang \u0111\u01b0\u1ee3c truy\u1ec1n qua WAN.<\/p>\n<p>Ngo\u00e0i ra khi s\u1eed d\u1ee5ng rsync, c\u1ea7n cung c\u1ea5p m\u1eadt kh\u1ea9u ng\u01b0\u1eddi d\u00f9ng <span style=\"font-weight: bold;\">root<\/span> \u0111\u1ec3 ho\u00e0n th\u00e0nh t\u00e1c v\u1ee5 c\u1ee5 th\u1ec3, v\u00ec v\u1eady vi\u1ec7c d\u00f9ng t\u00f9y ch\u1ecdn SSH s\u1ebd g\u1eedi th\u00f4ng tin \u0111\u0103ng nh\u1eadp c\u1ee7a b\u1ea1n theo c\u00e1ch \u0111\u01b0\u1ee3c m\u00e3 h\u00f3a \u0111\u1ec3 m\u1eadt khy\u1ea9u c\u1ee7a b\u1ea1n \u0111\u01b0\u1ee3c an to\u00e0n.<\/p>\n<p>\u0110\u1ec3 s\u1eed d\u1ee5ng rsync qua SSH, c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> -e<\/span> \u0111\u1ec3 ch\u1ec9 \u0111\u1ecbnh l\u1ec7nh shell t\u1eeb xa, th\u01b0\u1eddng l\u00e0 ssh nh\u01b0 b\u00ean d\u01b0\u1edbi<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\">rsync [OPTIONS] -e ssh \/path\/to\/source user@remote:\/path\/to\/destination<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">6. Sao ch\u00e9p t\u1ec7p t\u1eeb m\u00e1y ch\u1ee7 t\u1eeb xa sang c\u1ee5c b\u1ed9 b\u1eb1ng SSH<\/h3>\n<p>\u0110\u1ec3 \u0111\u1ed3ng b\u1ed9 h\u00f3a t\u1ec7p t\u1eeb m\u00e1y ch\u1ee7 t\u1eeb xa \u0111\u1ebfn m\u00e1y ch\u1ee7 c\u1ee5c b\u1ed9, b\u1ea1n c\u00f3 th\u1ec3 ch\u1ec9 \u0111\u1ecbnh giao th\u1ee9c v\u1edbi rsync b\u1eb1ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold;\">-e<\/span> v\u1edbi t\u00ean giao th\u1ee9c b\u1ea1n mu\u1ed1n s\u1eed d\u1ee5ng.<\/p>\n<p>\u1ede \u0111\u00e2y s\u1ebd s\u1eed d\u1ee5ng <span style=\"font-weight: bold;\">ssh<\/span> v\u1edbi t\u00f9y ch\u1ecdn <span style=\"font-weight: bold;\">-e<\/span> v\u00e0 th\u1ef1c hi\u1ec7n truy\u1ec1n d\u1eef li\u1ec7u.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avzhe ssh root@192.168.1.123:\/root\/anaconda-ks.cfg \/tmp\n\nroot@192.168.0.141's password: \nreceiving incremental file list\nanaconda-ks.cfg\n\nsent 43 bytes  received 1.10K bytes  325.43 bytes\/sec\ntotal size is 1.90K  speedup is 1.67<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">7. Sao ch\u00e9p t\u1ec7p t\u1eeb m\u00e1y ch\u1ee7 c\u1ee5c b\u1ed9 sang m\u00e1y ch\u1ee7 t\u1eeb xa b\u1eb1ng SSH<\/h3>\n<p>\u0110\u1ec3 \u0111\u1ed3ng b\u1ed9 h\u00f3a t\u1ec7p t\u1eeb m\u00e1y ch\u1ee7 c\u1ee5c b\u1ed9 v\u1edbi m\u00e1y ch\u1ee7 t\u1eeb xa b\u1eb1ng SSH, b\u1ea1n c\u00f3 th\u1ec3 t\u1eadn d\u1ee5ng l\u1ec7nh sau nh\u01b0 b\u00ean d\u01b0\u1edbi.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avzhe ssh backup.tar.gz root@192.168.0.141:\/backups\/\n\nroot@192.168.1.123's password: \nsending incremental file list\ncreated directory \/backups\nbackup.tar.gz\n\nsent 224.59K bytes  received 66 bytes  64.19K bytes\/sec\ntotal size is 224.40K  speedup is 1.00<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">8. Hi\u1ec3n th\u1ecb ti\u1ebfn tr\u00ecnh trong khi truy\u1ec1n d\u1eef li\u1ec7u b\u1eb1ng Rsync<\/h3>\n<p>\u0110\u1ec3 hi\u1ec3n th\u1ecb ti\u1ebfn tr\u00ecnh trong khi truy\u1ec1n d\u1eef li\u1ec7u t\u1eeb m\u00e1y n\u00e0y sang m\u00e1y kh\u00e1c, s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;progress<\/span>, t\u00f9y ch\u1ecdn n\u00e0y s\u1ebd hi\u1ec3n th\u1ecb c\u00e1c t\u1ec7p v\u00e0 th\u1eddi gian c\u00f2n l\u1ea1i \u0111\u1ec3 ho\u00e0n t\u1ea5t qu\u00e1 tr\u00ecnh truy\u1ec1n.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avzhe ssh --progress \/root\/rpmpkgs root@192.168.0.141:\/root\/rpmpkgs\n\nroot@192.168.1.123's password: \nsending incremental file list\nrpmpkgs\/\nrpmpkgs\/httpd-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\n          1.47M 100%   31.80MB\/s    0:00:00 (xfr#1, to-chk=3\/5)\nrpmpkgs\/mod_ssl-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64.rpm\n        138.01K 100%    2.69MB\/s    0:00:00 (xfr#2, to-chk=2\/5)\nrpmpkgs\/nagios-4.4.6-4.el8.x86_64.rpm\n          2.01M 100%   18.45MB\/s    0:00:00 (xfr#3, to-chk=1\/5)\nrpmpkgs\/nagios-plugins-2.3.3-5.el8.x86_64.rpm\n        120.48K 100%    1.04MB\/s    0:00:00 (xfr#4, to-chk=0\/5)\n\nsent 3.74M bytes  received 96 bytes  1.50M bytes\/sec\ntotal size is 3.74M  speedup is 1.00<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">9. G\u1ed3m c\u00e1c t\u1ec7p c\u00f3 ph\u1ea7n m\u1edf r\u1ed9ng \u0111\u1eb7c bi\u1ec7t v\u1edbi rsync<\/h3>\n<p>\u0110\u1ec3 \u1ea5n \u0111\u1ecbnh c\u00e1c t\u1ec7p ho\u1eb7c m\u1eabu c\u1ee5 th\u1ec3 trong qu\u00e1 tr\u00ecnh ho\u1ea1t \u0111\u1ed9ng rsync, s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;include<\/span> v\u1edbi ti\u1ec7n \u00edch m\u1edf r\u1ed9ng ph\u00f9 h\u1ee3p v\u1edbi t\u1ea5t c\u1ea3 c\u00e1c t\u1ec7p.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avz --include='*.txt' \/path\/to\/source\/ user@remote:\/path\/to\/destination\/<\/span>\n<\/code><\/pre>\n<p>Rsync s\u1ebd ch\u1ec9 bao g\u1ed3m c\u00e1c t\u1ec7p c\u00f3 ph\u1ea7n \u0111u\u00f4i <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">.txt<\/span> t\u1eeb th\u01b0 m\u1ee5c <span style=\"font-weight: bold;\">\/path\/to\/source\/<\/span> trong qu\u00e1 tr\u00ecnh truy\u1ec1n<\/p>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">10. Lo\u1ea1i tr\u1eeb c\u00e1c t\u1ec7p c\u00f3 ph\u1ea7n m\u1edf r\u1ed9ng c\u1ee5 th\u1ec3 b\u1eb1ng rsync<\/h3>\n<p>T\u01b0\u01a1ng t\u1ef1 \u0111\u1ec3 lo\u1ea1i tr\u1eeb m\u1ed9t ti\u1ec7n \u00edch m\u1edf r\u1ed9ng c\u1ee5 th\u1ec3 trong qu\u00e1 tr\u00ecnh ho\u1ea1t \u0111\u1ed9ng <span style=\"font-weight: bold;\">rsync<\/span>, s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\"> &#8211;exclude<\/span> v\u1edbi m\u1eabu k\u00fd t\u1ef1 \u0111\u1ea1i di\u1ec7n c\u1ea7n lo\u1ea1i b\u1ecf.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avz --exclude='*.ext' \/path\/to\/source\/ user@remote:\/path\/to\/destination\/<\/span>\n<\/code><\/pre>\n<p>Rsync s\u1ebd lo\u1ea1i tr\u1eeb c\u00e1c t\u1ec7p c\u00f3 ph\u1ea7n m\u1edf r\u1ed9ng \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">(*.ext)<\/span> trong qu\u00e1 tr\u00ecnh truy\u1ec1n, \u0111\u1ed3ng th\u1eddi bao g\u1ed3m t\u1ea5t c\u1ea3 c\u00e1c t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c kh\u00e1c.<\/p>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">11. Bao g\u1ed3m v\u00e0 lo\u1ea1i tr\u1eeb c\u00e1c t\u1ec7p b\u1eb1ng rsync<\/h3>\n<p>\u0110\u1ec3 bao g\u1ed3m v\u00e0 lo\u1ea1i tr\u1eeb c\u00e1c t\u1ec7p ho\u1eb7c m\u1eabu c\u1ee5 th\u1ec3 trong qu\u00e1 tr\u00ecnh ho\u1ea1t \u0111\u1ed9ng rsync,<br \/>\nc\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u1ea3 hai t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;include<\/span> v\u00e0 <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;exclude<\/span> v\u1edbi c\u00e1c m\u1eabu k\u00fd t\u1ef1 \u0111\u1ea1i di\u1ec7n th\u00edch h\u1ee3p.<\/p>\n<p>Hai t\u00f9y ch\u1ecdn n\u00e0y cho ph\u00e9p ch\u00fang ta bao g\u1ed3m v\u00e0 lo\u1ea1i tr\u1eeb c\u00e1c t\u1ec7p b\u1eb1ng c\u00e1ch ch\u1ec9 \u0111\u1ecbnh c\u00e1c tham s\u1ed1. T\u00f9y ch\u1ecdn n\u00e0y gi\u00fap ch\u00fang t\u00f4i ch\u1ec9 \u0111\u1ecbnh c\u00e1c t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c m\u00e0 b\u1ea1n mu\u1ed1n \u0111\u01b0a v\u00e0o \u0111\u1ed3ng b\u1ed9 h\u00f3a v\u00e0 lo\u1ea1i tr\u1eeb c\u00e1c t\u1ec7p, th\u01b0 m\u1ee5c kh\u00f4ng mu\u1ed1n chuy\u1ec3n.<\/p>\n<p>l\u1ec7nh rsync s\u1ebd ch\u1ec9 bao g\u1ed3m c\u00e1c t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c b\u1eaft \u0111\u1ea7u b\u1eb1ng <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">R<\/span> v\u00e0 lo\u1ea1i tr\u1eeb t\u1ea5t c\u1ea3 c\u00e1c t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c kh\u00e1c.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avze ssh --include 'R*' --exclude '*' root@192.168.1.123:\/var\/lib\/rpm\/ \/root\/rpm<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">12. S\u1eed d\u1ee5ng -delete v\u1edbi rsync<\/h3>\n<p>N\u1ebfu t\u1ec7p ho\u1eb7c m\u1ed9t th\u01b0 m\u1ee5c kh\u00f4ng t\u1ed3n t\u1ea1i \u1edf ngu\u1ed3n nh\u01b0ng \u0111\u00e3 t\u1ed3n t\u1ea1i \u1edf \u0111\u00edch, b\u1ea1n c\u00f3 th\u1ec3 mu\u1ed1n x\u00f3a t\u1ec7p\/th\u01b0 m\u1ee5c hi\u1ec7n c\u00f3 \u0111\u00f3 \u1edf \u0111\u00edch \u0111\u1ec3 \u0111\u1ed3ng b\u1ed9 h\u00f3a.<\/p>\n<p>Ch\u00fang ta c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;delete<\/span> \u0111\u1ec3 x\u00f3a c\u00e1c t\u1ec7p kh\u00f4ng c\u00f3 trong th\u01b0 m\u1ee5c ngu\u1ed3n.<\/p>\n<p>Ngu\u1ed3n v\u00e0 \u0111\u00edch \u0111\u01b0\u1ee3c \u0111\u1ed3ng b\u1ed9 h\u00f3a. v\u00e0 h\u00e3y t\u1ea1o m\u1ed9t t\u1ec7p test.txt \u0111\u1ec3 ki\u1ec3m ch\u1ee9ng<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\">[root@longvan:~]# cd \/root\/rpm\/\n[root@longvan:~\/rpm]# touch test.txt\n[root@longvan:~\/rpm]# rsync -avz --delete root@192.168.1.132:\/var\/lib\/rpm\/ \/root\/rpm\/\n\nroot@192.168.1.132's password: \nreceiving incremental file list\ndeleting test.txt\n.\/\n.dbenv.lock\n.rpm.lock\nBasenames\nConflictname\nDirnames\nEnhancename\nFiletriggername\nGroup\nInstalltid\nName\nObsoletename\nPackages\nProvidename\nSha1header\nSigmd5\nSuggestname\nSupplementname\nTransfiletriggername\nTriggername\n__db.001\n__db.002\n__db.003\n\nsent 445 bytes  received 18,543,954 bytes  2,472,586.53 bytes\/sec\ntotal size is 71,151,616  speedup is 3.84<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">13. \u0110\u1eb7t gi\u1edbi h\u1ea1n truy\u1ec1n t\u1ec7p b\u1eb1ng Rsync<\/h3>\n<p>B\u1ea1n c\u00f3 th\u1ec3 ch\u1ec9 \u0111\u1ecbnh k\u00edch th\u01b0\u1edbc t\u1ec7p t\u1ed1i \u0111a s\u1ebd \u0111\u01b0\u1ee3c chuy\u1ec3n ho\u1eb7c \u0111\u1ed3ng b\u1ed9 h\u00f3a.<br \/>\nC\u00f3 th\u1ec3 l\u00e0m \u0111i\u1ec1u \u0111\u00f3 v\u1edbi t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;max-size<\/span>. \u1ede \u0111\u00e2y k\u00edch th\u01b0\u1edbc t\u1ec7p t\u1ed1i \u0111a l\u00e0 200k, n\u00ean l\u1ec7nh n\u00e0y s\u1ebd ch\u1ec9 chuy\u1ec3n nh\u1eefng t\u1ec7p b\u1eb1ng ho\u1eb7c nh\u1ecf h\u01a1n 200k.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -avzhe ssh --max-size='200k' \/var\/lib\/rpm\/ root@192.168.1.123:\/root\/tmprpm\n\nroot@192.168.1.123's password: \nsending incremental file list\ncreated directory \/root\/tmprpm\n.\/\n.dbenv.lock\n.rpm.lock\nConflictname\nEnhancename\nFiletriggername\nGroup\nInstalltid\nName\nObsoletename\nRecommendname\nRequirename\nSha1header\nSigmd5\nSuggestname\nSupplementname\nTransfiletriggername\nTriggername\n__db.002\n\nsent 129.52K bytes  received 396 bytes  28.87K bytes\/sec\ntotal size is 71.15M  speedup is 547.66<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">14. T\u1ef1 \u0111\u1ed9ng x\u00f3a t\u1eadp tin ngu\u1ed3n sau khi chuy\u1ec3n<\/h3>\n<p>Tr\u01b0\u1eddng h\u1ee3p n\u1ebfu b\u1ea1n c\u00f3 m\u1ed9t m\u00e1y ch\u1ee7 web ch\u00ednh v\u00e0 m\u00e1y ch\u1ee7 sao l\u01b0u d\u1eef li\u1ec7u, b\u1ea1n \u0111\u00e3 t\u1ea1o b\u1ea3n sao l\u01b0u h\u00e0ng ng\u00e0y v\u00e0 \u0111\u1ed9ng b\u1ed9 h\u00f3a v\u1edbi m\u00e1y ch\u1ee7 d\u1eef ph\u00f2ng c\u1ee7a m\u00ecnh, nh\u01b0ng b\u00e2y gi\u1edd b\u1ea1n kh\u00f4ng mu\u1ed1n gi\u1eef b\u1ea3n sao l\u01b0u c\u1ee5c b\u1ed9 \u0111\u00f3 trong m\u00e1y ch\u1ee7 web c\u1ee7a m\u00ecnh.<\/p>\n<p>V\u00ec v\u1eady, b\u1ea1n s\u1ebd \u0111\u1ee3i qu\u00e1 tr\u00ecnh chuy\u1ec3n ho\u00e0n t\u1ea5t r\u1ed3i x\u00f3a t\u1ec7p sao l\u01b0u c\u1ee5c b\u1ed9 \u0111\u00f3 theo c\u00e1ch th\u1ee7 c\u00f4ng kh\u00f4ng? D\u0129 nhi\u00ean l\u00e0 kh\u00f4ng. Vi\u1ec7c x\u00f3a t\u1ef1 \u0111\u1ed9ng n\u00e0y c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n b\u1eb1ng c\u00e1c s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;remove-source-files<\/span><\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync --remove-source-files -zvh backup.tar.gz root@192.168.1.123:\/tmp\/backups\/\n\nroot@192.168.1.123's password: \nbackup.tar.gz\n\nsent 795 bytes  received 2.33K bytes  894.29 bytes\/sec\ntotal size is 267.30K  speedup is 85.40\n\n[root@longvan:~]# ls -l backup.tar.gz\n\nls: cannot access 'backup.tar.gz': No such file or directory<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">15. Ch\u1ea1y th\u1eed v\u1edbi Rsync<\/h3>\n<p>N\u1ebfu b\u1ea1n m\u1edbi s\u1eed d\u1ee5ng rsync v\u00e0 kh\u00f4ng bi\u1ebft ch\u00ednh x\u00e1c l\u1ec7nh ho\u1ea1t \u0111\u1ed9ng ra sao. Rsync th\u1ef1c s\u1ef1 c\u00f3 th\u1ec3 l\u00e0m x\u00e1o tr\u1ed9n m\u1ecdi th\u1ee9 trong th\u01b0 m\u1ee5c \u0111\u00edch c\u1ee7a b\u1ea1n v\u00e0 sau \u0111\u00f3 l\u00e0m h\u1ecfng m\u1ecdi th\u1ee9.<\/p>\n<p>Vi\u1ec7c s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn n\u00e0y s\u1ebd kh\u00f4ng th\u1ef1c hi\u1ec7n b\u1ea5t k\u00fd thay \u0111\u1ed5i n\u00e0o v\u1edbi c\u00e1c t\u1ec7p v\u00e0 hi\u1ec3n th\u1ecb \u0111\u1ea7u ra c\u1ee7a l\u1ec7nh, n\u1ebfu \u0111\u1ea7u ra hi\u1ec3n th\u1ecb ch\u00ednh x\u00e1c nh\u01b0 b\u1ea1n mu\u1ed1n th\u00ec b\u1ea1n c\u00f3 th\u1ec3 x\u00f3a t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;dry-run<\/span> kh\u1ecfi l\u1ec7nh c\u1ee7a m\u00ecnh v\u00e0 ch\u1ea1y tr\u00ean thi\u1ebft b\u1ecb \u0111\u1ea7u cu\u1ed1i.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync --dry-run --remove-source-files -zvh backup.tar.gz root@192.168.1.123:\/tmp\/backups\/\n\nroot@192.168.1.123's password: \nbackup.tar.gz\n\nsent 50 bytes  received 19 bytes  19.71 bytes\/sec\ntotal size is 267.30K  speedup is 3,873.97 (DRY RUN)<\/span>\n<\/code><\/pre>\n<h3 style=\"font-family: inherit; font-weight: 600; font-size: 22px; line-height: 1.4em; border-bottom: 2px dashed #ededed; color: #8262d8;\">16. \u0110\u1eb7t gi\u1edbi h\u1ea1n b\u0103ng th\u00f4ng v\u00e0 truy\u1ec1n t\u1ec7p trong l\u1ec7nh rsync<\/h3>\n<p>B\u1ea1n c\u00f3 th\u1ec3 \u0111\u1eb7t gi\u1edbi h\u1ea1n b\u0103ng th\u00f4ng trong khi truy\u1ec1n d\u1eef li\u1ec7u t\u1eeb m\u00e1y n\u00e0y sang m\u00e1y kh\u00e1c v\u1edbi s\u1ef1 tr\u1ee3 gi\u00fap c\u1ee7a t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">&#8211;bwlimit<\/span>. T\u00f9y ch\u1ecdn n\u00e0y gi\u00fap ch\u00fang ta gi\u1edbi h\u1ea1n b\u0103ng th\u00f4ng I\/O.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync --bwlimit=100 -avzhe ssh  \/var\/lib\/rpm\/  root@192.168.1.123:\/root\/tmprpm\/\nroot@192.168.1.123's password:\nsending incremental file list\nsent 324 bytes  received 12 bytes  61.09 bytes\/sec\ntotal size is 38.08M  speedup is 113347.05<\/span>\n<\/code><\/pre>\n<p>Ngo\u00e0i ra, theo m\u1eb7c \u0111\u1ecbnh rsync ch\u1ec9 \u0111\u1ed3ng b\u1ed9 h\u00f3a c\u00e1c kh\u1ed1i v\u00e0 byte \u0111\u00e3 thay \u0111\u1ed5i, n\u1ebfu b\u1ea1n mu\u1ed1n \u0111\u1ed3ng b\u1ed9 h\u00f3a to\u00e0n b\u1ed9 t\u1ec7p m\u1ed9t c\u00e1c r\u00f5 r\u00e0ng th\u00ec b\u1ea1n s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <span style=\"font-weight: bold; color: #006cb0; background-color: #f5f5f5; padding: 2px 4px; border: 1px solid #d3dce6; border-radius: 4px;\">-W<\/span> v\u1edbi n\u00f3.<\/p>\n<pre style=\"color: #313131; border-radius: 4px; padding: 0.65em 0.65em;\"><code class=\"language-shell\"><span class=\"token function\"># rsync -zvhW backup.tar \/tmp\/backups\/backup.tar\nbackup.tar\nsent 14.71M bytes  received 31 bytes  3.27M bytes\/sec\ntotal size is 16.18M  speedup is 1.10<\/span>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I. L\u1ec7nh Rsync&nbsp; Rsync (Remote Sync) l\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn \u0111\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 h\u00f3a c\u00e1c t\u1ec7p, th\u01b0 m\u1ee5c t\u1eeb xa c\u0169ng nh\u01b0 c\u1ee5c b\u1ed9 trong c\u00e1c h\u1ec7 th\u1ed1ng Linux\/Unix. V\u1edbi s\u1ef1 tr\u1ee3 gi\u00fap c\u1ee7a l\u1ec7nh rsync, c\u00f3 th\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u t\u1eeb xa v\u00e0 n\u1ed9i [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_oasis_is_in_workflow":0,"_oasis_original":0,"footnotes":""},"categories":[4],"tags":[255,254,258,257,5,143,116],"class_list":["post-3154","post","type-post","status-publish","format-standard","hentry","category-linux","tag-chuyen-du-lieu","tag-dong-bo-du-lieu","tag-include-exclude","tag-limit","tag-linux","tag-rsync","tag-ssh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync - command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux - Long V\u00e2n<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync - command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux - Long V\u00e2n\" \/>\n<meta property=\"og:description\" content=\"I. L\u1ec7nh Rsync&nbsp; Rsync (Remote Sync) l\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn \u0111\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 h\u00f3a c\u00e1c t\u1ec7p, th\u01b0 m\u1ee5c t\u1eeb xa c\u0169ng nh\u01b0 c\u1ee5c b\u1ed9 trong c\u00e1c h\u1ec7 th\u1ed1ng Linux\/Unix. V\u1edbi s\u1ef1 tr\u1ee3 gi\u00fap c\u1ee7a l\u1ec7nh rsync, c\u00f3 th\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u t\u1eeb xa v\u00e0 n\u1ed9i [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"Long V\u00e2n\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-23T05:28:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-07T11:58:05+00:00\" \/>\n<meta name=\"author\" content=\"V\u0169 Thi\u1ec7n Quang\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"V\u0169 Thi\u1ec7n Quang\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/\"},\"author\":{\"name\":\"V\u0169 Thi\u1ec7n Quang\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#\\\/schema\\\/person\\\/d8575ab23f69ff6ff8fe27d082eb9f43\"},\"headline\":\"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync &#8211; command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux\",\"datePublished\":\"2023-11-23T05:28:26+00:00\",\"dateModified\":\"2024-04-07T11:58:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/\"},\"wordCount\":2304,\"publisher\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#organization\"},\"keywords\":[\"chuy\u1ec3n d\u1eef li\u1ec7u\",\"\u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u\",\"include exclude\",\"limit\",\"Linux\",\"rsync\",\"ssh\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"vi\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/\",\"url\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/\",\"name\":\"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync - command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux - Long V\u00e2n\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#website\"},\"datePublished\":\"2023-11-23T05:28:26+00:00\",\"dateModified\":\"2024-04-07T11:58:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Trang ch\u1ee7\",\"item\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync &#8211; command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#website\",\"url\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/\",\"name\":\"Long V\u00e2n\",\"description\":\"C\u1ed9ng \u0110\u1ed3ng\",\"publisher\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#organization\",\"name\":\"Long V\u00e2n\",\"url\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/cropped-logo-longvancloudsolution.png\",\"contentUrl\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/cropped-logo-longvancloudsolution.png\",\"width\":1300,\"height\":330,\"caption\":\"Long V\u00e2n\"},\"image\":{\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/#\\\/schema\\\/person\\\/d8575ab23f69ff6ff8fe27d082eb9f43\",\"name\":\"V\u0169 Thi\u1ec7n Quang\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae494bee7d6ab274d4c5215c38c7a27e24822330d41ab77e89f2bfbeebe6ba5d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae494bee7d6ab274d4c5215c38c7a27e24822330d41ab77e89f2bfbeebe6ba5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ae494bee7d6ab274d4c5215c38c7a27e24822330d41ab77e89f2bfbeebe6ba5d?s=96&d=mm&r=g\",\"caption\":\"V\u0169 Thi\u1ec7n Quang\"},\"sameAs\":[\"http:\\\/\\\/longvan.net\"],\"url\":\"https:\\\/\\\/longvan.net\\\/cong-dong\\\/author\\\/thienquang\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync - command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux - Long V\u00e2n","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/","og_locale":"vi_VN","og_type":"article","og_title":"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync - command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux - Long V\u00e2n","og_description":"I. L\u1ec7nh Rsync&nbsp; Rsync (Remote Sync) l\u00e0 l\u1ec7nh \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ph\u1ed5 bi\u1ebfn \u0111\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 h\u00f3a c\u00e1c t\u1ec7p, th\u01b0 m\u1ee5c t\u1eeb xa c\u0169ng nh\u01b0 c\u1ee5c b\u1ed9 trong c\u00e1c h\u1ec7 th\u1ed1ng Linux\/Unix. V\u1edbi s\u1ef1 tr\u1ee3 gi\u00fap c\u1ee7a l\u1ec7nh rsync, c\u00f3 th\u1ec3 sao ch\u00e9p v\u00e0 \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u t\u1eeb xa v\u00e0 n\u1ed9i [&hellip;]","og_url":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/","og_site_name":"Long V\u00e2n","article_published_time":"2023-11-23T05:28:26+00:00","article_modified_time":"2024-04-07T11:58:05+00:00","author":"V\u0169 Thi\u1ec7n Quang","twitter_card":"summary_large_image","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"V\u0169 Thi\u1ec7n Quang","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"15 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/#article","isPartOf":{"@id":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/"},"author":{"name":"V\u0169 Thi\u1ec7n Quang","@id":"https:\/\/longvan.net\/cong-dong\/#\/schema\/person\/d8575ab23f69ff6ff8fe27d082eb9f43"},"headline":"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync &#8211; command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux","datePublished":"2023-11-23T05:28:26+00:00","dateModified":"2024-04-07T11:58:05+00:00","mainEntityOfPage":{"@id":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/"},"wordCount":2304,"publisher":{"@id":"https:\/\/longvan.net\/cong-dong\/#organization"},"keywords":["chuy\u1ec3n d\u1eef li\u1ec7u","\u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u","include exclude","limit","Linux","rsync","ssh"],"articleSection":["Linux"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/","url":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/","name":"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync - command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux - Long V\u00e2n","isPartOf":{"@id":"https:\/\/longvan.net\/cong-dong\/#website"},"datePublished":"2023-11-23T05:28:26+00:00","dateModified":"2024-04-07T11:58:05+00:00","breadcrumb":{"@id":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/longvan.net\/cong-dong\/huong-dan-su-dung-rsync-command-dong-bo-du-lieu-tren-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Trang ch\u1ee7","item":"https:\/\/longvan.net\/cong-dong\/"},{"@type":"ListItem","position":2,"name":"H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng Rsync &#8211; command \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u tr\u00ean linux"}]},{"@type":"WebSite","@id":"https:\/\/longvan.net\/cong-dong\/#website","url":"https:\/\/longvan.net\/cong-dong\/","name":"Long V\u00e2n","description":"C\u1ed9ng \u0110\u1ed3ng","publisher":{"@id":"https:\/\/longvan.net\/cong-dong\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/longvan.net\/cong-dong\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/longvan.net\/cong-dong\/#organization","name":"Long V\u00e2n","url":"https:\/\/longvan.net\/cong-dong\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/longvan.net\/cong-dong\/#\/schema\/logo\/image\/","url":"https:\/\/longvan.net\/cong-dong\/wp-content\/uploads\/2025\/11\/cropped-logo-longvancloudsolution.png","contentUrl":"https:\/\/longvan.net\/cong-dong\/wp-content\/uploads\/2025\/11\/cropped-logo-longvancloudsolution.png","width":1300,"height":330,"caption":"Long V\u00e2n"},"image":{"@id":"https:\/\/longvan.net\/cong-dong\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/longvan.net\/cong-dong\/#\/schema\/person\/d8575ab23f69ff6ff8fe27d082eb9f43","name":"V\u0169 Thi\u1ec7n Quang","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/secure.gravatar.com\/avatar\/ae494bee7d6ab274d4c5215c38c7a27e24822330d41ab77e89f2bfbeebe6ba5d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ae494bee7d6ab274d4c5215c38c7a27e24822330d41ab77e89f2bfbeebe6ba5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ae494bee7d6ab274d4c5215c38c7a27e24822330d41ab77e89f2bfbeebe6ba5d?s=96&d=mm&r=g","caption":"V\u0169 Thi\u1ec7n Quang"},"sameAs":["http:\/\/longvan.net"],"url":"https:\/\/longvan.net\/cong-dong\/author\/thienquang\/"}]}},"_links":{"self":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts\/3154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/comments?post=3154"}],"version-history":[{"count":191,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts\/3154\/revisions"}],"predecessor-version":[{"id":4671,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts\/3154\/revisions\/4671"}],"wp:attachment":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/media?parent=3154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/categories?post=3154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/tags?post=3154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}