資料複製的問題 - Linux

Table of Contents

※ 引述《mochii (麻糬)》之銘言:
: 假設要把分割區sda1內的檔案和資料夾都複製到sdc1
: 還要保留檔案權限等等資訊
: 要用哪些指令比較適合阿?
: 剛剛用過dd拷貝
: 結果發現因為sda1(100G)和sdc1(200G)大小不同
: copy完sdc1分割變成和sda1大小一樣了 @@


cp 就可以了

man cp

-p Cause cp to preserve the following attributes of each source file
in the copy: modification time, access time, file flags, file mode,
user ID, and group ID, as allowed by permissions.

cp -Rpv /sda1/* /sdc1/

這樣就可以了

或者是

切換到 sdc1 資料夾

tar -cvf - /sda1 | tar -xvf -


--
Appleboy Blog: http://blog.Wu-Boy.com
Appleboy Life: http://life.wu-boy.com

--

All Comments

Faithe avatarFaithe2009-01-08
thx
Charlotte avatarCharlotte2009-01-08
cp -a不是更快 :p