19,613
社区成员
发帖
与我相关
我的任务
分享
# tar cfC - /usr/src . | tar xpfC - /mnt
# rm -rf /usr/src/*
# umount /mnt
# mount /usr/src
mount /usr/src
只是想表明把新硬盘挂载到这个目录而已。
不把/usr/src下的内容清空的话,这些内容依然会占用原有硬盘的空间,达不到释放老硬盘空间的目的。
不如不关心老硬盘的空间占用,那么没有影响。
在把新硬盘mount 到/usr/src之后,原有/usr/src下的内容是看不到的。tar cfC - /usr/src .
效果等价于
tar -cf temp.tar -C /usr/src . && cat temp.tar
.表示工作目录,因为有-C /usr/src的限制,所以工作目录是/usr/src/.# tar cfC - /old/directory . | tar xpfC - /tempmount
If you don’t speak Unix at parties, this looks fairly stunning. Let’s
dismantle it. First, we go to the old directory and tar up everything. Then
pipe the output to a second command, which extracts the backup in the new
directory. When this command finishes, your files are installed on their new
disk. For example, to move /usr/src onto a new partition temporarily mounted
at /mnt, you would do this:
# tar cfC - /usr/src . | tar xpfC - /mnt
Check the temporary mount point to be sure that your files are actually
there. Once you’re confident that the files are properly moved, remove the
files from the old directory and mount the disk in the new location. For
example, after duplicating your files from /usr/src, you would run:
# rm -rf /usr/src/*
# umount /mnt
# mount /usr/src
应该没有,因为书中提到是新接了一个硬盘,然后把/usr/src的内容转移过去,如果在fstab有项的话,应该还得修改fstab吧?贴一下书中的内容,谢谢!
mount /usr/src
可能是在fstab里面已经有指定/usr/src对应的项了