How to copy entire operation system to another place without `dd`

How to copy entire operation system to another place without command dd.

For example, you bought a new hard disk, but there were no OS. You wanted to copy all the file to the new disk, even the entire OS.

How to do that?

rsync

This command can be used to synchronize a folder, and also resume copying when it’s aborted half way. The command to copy one disk is:

rsync -avxHAX --progress / /new-disk/

The options are:

-a  : all files, with permissions, etc..
-v  : verbose, mention files
-x  : stay on one file system
-H  : preserve hard links (not included with -a)
-A  : preserve ACLs/permissions (not included with -a)
-X  : preserve extended attributes (not included with -a)

To improve the copy speed, add -W (–whole-file), to avoid calculating deltas/diffs of the files. This is the default when both the source and destination are specified as local paths, since the real benefit of rsync’s delta-transfer algorithm is reducing network usage.

Also consider adding –numeric-ids to avoid mapping uid/gid values by user/group name.

Step1. Copy File

Just use this sample command to copy entire file to another place:

$ rsync -avxHAXW --progress --numeric-ids /old-disk/ /new-disk/

Step2. Boot Repair

Then to boot your ‘new’ operation system, you also need repair your grub.

Download boot-repair or boot-repair-disk to fix your new os.

What’s More

You can use this command to synchronize any file, even to copy a virtual disk to a physical disk! Nothing different between your virtual machine and your physical machine.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TaQini852

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值