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

使用像是gparted live的linux開機

sudo gparted /dev/sda

![](/files/-LpCRQ10vhXfVaOKVM6W)

```
建立類似以下的分割區
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分鐘

![](/files/-LpSELEFR9A05zYe3QDP)

![](/files/-LpSD3ZN7VmvNKIxmeT-)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/andoid-shou-ji/untitled/shi-yong-rsync-fu-yuan-xi-tong-dao-xin-ci-die.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
