目录同步 linux,Linux系统目录实时同步
1.當(dāng)操作系統(tǒng)根分區(qū)空間不夠時(shí)(有大量的日志寫入或應(yīng)用部署在根分區(qū)),可以將單個(gè)或多個(gè)目錄進(jìn)行同步出來,源目錄是磁盤較大的分區(qū),目標(biāo)目錄是在根分區(qū)下,實(shí)際文件寫入在較大的分區(qū)。
[root@mysql01 ~]# mkdir /home/123? /123? ? ? --創(chuàng)建兩個(gè)需要同步的目錄
[root@mysql01 ~]# vim /etc/fstab? ? ?--添加以下行
/home/123? ? ? ? ? ? ? ?/123? ? ? ? ? ? ? ? ? ? none? ? bind? ? ? ? ? ? 0 0
[root@mysql01 ~]# mount -a
[root@mysql01 ~]# touch /home/123/1.txt? ? ?--在源目錄寫入文件直接同步到目標(biāo)目錄
[root@mysql01 ~]# ll /home/123/
total 0
-rw-r--r-- 1 root root 0 Mar 20 17:21 1.txt
[root@mysql01 ~]# ll /123/
total 0
-rw-r--r-- 1 root root 0 Mar 20 17:21 1.txt
[root@mysql01 ~]# touch /123/2.txt? ? ? -
-在目標(biāo)目錄寫入文件直接同步到源目錄
[root@mysql01 ~]# ll /home/123/
total 0
-rw-r--r-- 1 root root 0 Mar 20 17:21 1.txt
-rw-r--r-- 1 root root 0 Mar 20 17:21 2.txt
[root@mysql01 ~]# ll /123/
total 0
-rw-r--r-- 1 root root 0 Mar 20 17:21 1.txt
-rw-r--r-- 1 root root 0 Mar 20 17:21 2.txt
[root@mysql01 ~]#
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的目录同步 linux,Linux系统目录实时同步的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 葡萄城报表介绍:B/S 报表软件
- 下一篇: linux下makefile中cp,ma