linux備份命令

來源:互聯網
上載者:User

linux備份命令 在完全備份工具中,3個工具tar,cpio與dump都很常用。cpio的最大好處就是連一般的裝置檔案都可以複製過來,所以使用cpio進行完全備份是很棒的一個選擇。不過需要注意的是,cpio需要藉助find 或其他可以找到檔案的指令的協助才可以正常工作。
 1. 使用cpio 進行備份與反備份[root @test /root]# find / -print | cpio -covB > /dev/st0 <==備份至tap [root @test /root]# cpio -iduv < /dev/st0   <==用tap將資料存回系統中 2. 使用tar 備份[root @test /root]# tar -zcvf host.tar.gz / --exclude /proc --exclude /mnt --exclude /tmp [root @test /root]# tar -zxvf host.tar.gz 至於部份備份,我們就以簡單的tar進行說明。假如我們需要備份的資料是每天的MySQL 資料庫,由於我想讓每天的資料都存成不同的檔案,而且檔案的新舊以日期作為區分最簡單,所以我可以這樣做:[root @test /root]# tar -zcvf mysql.`date +%Y-%m-%d`.tar.gz /var/lib/mysql  [root @test /root]# tar -N '2002/07/05' -zcvf home.tar.gz /home 只有在比2002/07/05 還要新的檔案,在/home 下的檔案才會被打包進home.tar.gz 中
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.