> For the complete documentation index, see [llms.txt](https://kawsing.gitbook.io/opensystem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kawsing.gitbook.io/opensystem/andoid-shou-ji/untitled/shi-yong-rsync-fu-yuan-xi-tong-dao-xin-ci-die.md).

# 使用rsync復原系統到新磁碟

使用像是gparted live的linux開機

sudo gparted /dev/sda

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-LpCNh6809r_dyAP9CwX%2F-LpCRQ10vhXfVaOKVM6W%2F%E5%9C%96%E7%89%87.png?alt=media\&token=6e0e7a2b-264a-4694-8257-69030dbd99c5)

```
建立類似以下的分割區
Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdj1  *         2048 908398591 908396544 433.2G 83 Linux
/dev/sdj2       908398592 976773119  68374528  32.6G  5 Extended
/dev/sdj5       908400640 976773119  68372480  32.6G 82 Linux swap / Solaris
```

以NFS掛載備份目錄

mount -t nfs IP:/SystemBackup /mnt

```
sudo mount /dev/sda1 /mnt 
rsync -aAXv --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found} root@120.115.4.160:/ /mnt/
cd /mnt
mkdir dev proc sys tmp run mnt media
grub-install --root-directory=/mnt /dev/sda
blkid /dev/sda1 
blkid /dev/sda5
#置換/mnt/boot/grub.cfg的 uuid
#置換/mnt/etc/fstab的/與swap uuid
```

從備份安裝到新磁碟，系統停機，安裝新磁碟，開機到恢復服務花費總時間（16:01\~16:20），花費19分鐘

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-LpSEJELvIhp_EIrQ1UL%2F-LpSELEFR9A05zYe3QDP%2Fimage.png?alt=media\&token=9e9144c1-fdbe-4cc7-beaf-7b606f94d371)

![](https://529150212-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lh81JtaIQ84bwQqz_Wh%2F-LpSD1xcdwvu6s1b0-Ol%2F-LpSD3ZN7VmvNKIxmeT-%2Fimage.png?alt=media\&token=d34a23d8-c027-451d-92d3-8850d069aed4)
