儲存在備份映像/檔案中

儲存在備份映像/檔案中

我有一台設備,裡面有一個主機板,可以啟動到基於 Linux 的作業系統。我有興趣能夠克隆這個硬碟,以便在它故障的情況下我有一個備份計劃來保持設備正常工作。到目前為止,我已經能夠將硬碟安裝到另一台運行 Linux 的 PC 上,並且能夠將資料從分割區中刪除。但是我不知道如何處理兩個分區 - sdb2 和 sdb13,它們不顯示為 EXT3 檔案系統; sdb2 是 0x05 擴充的,而 sdb13 是 0x83 的,它沒有顯示它有任何檔案系統,我無法安裝它。如果我使用不同大小的新硬碟,我還不確定如何處理 GRUB。我想知道我想做的事情是否可能......如果我從以下內容中有足夠的信息

輸出來自fdisk -l

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00066c45

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63      208844      104391   83  Linux
Partition 1 does not start on physical sector boundary.
/dev/sdb2          208845    31262489    15526822+   5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sdb5          208908     6650909     3221001   83  Linux
Partition 5 does not start on physical sector boundary.
/dev/sdb6         6650973     7052534      200781   83  Linux
Partition 6 does not start on physical sector boundary.
/dev/sdb7         7052598     7646939      297171   83  Linux
Partition 7 does not start on physical sector boundary.
/dev/sdb8         7647003     7855784      104391   83  Linux
Partition 8 does not start on physical sector boundary.
/dev/sdb9         7855848    15679439     3911796   83  Linux
/dev/sdb10       15679503    23503094     3911796   83  Linux
Partition 10 does not start on physical sector boundary.
/dev/sdb11       23503158    24097499      297171   83  Linux
Partition 11 does not start on physical sector boundary.
/dev/sdb12       24097563    24691904      297171   83  Linux
Partition 12 does not start on physical sector boundary.
/dev/sdb13       24691968    31262489     3285261   83  Linux

輸出來自sfdisk -d

# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=       63, size=   208782, Id=83
/dev/sdb2 : start=   208845, size= 31053645, Id= 5
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0
/dev/sdb5 : start=   208908, size=  6442002, Id=83
/dev/sdb6 : start=  6650973, size=   401562, Id=83
/dev/sdb7 : start=  7052598, size=   594342, Id=83
/dev/sdb8 : start=  7647003, size=   208782, Id=83
/dev/sdb9 : start=  7855848, size=  7823592, Id=83
/dev/sdb10: start= 15679503, size=  7823592, Id=83
/dev/sdb11: start= 23503158, size=   594342, Id=83
/dev/sdb12: start= 24097563, size=   594342, Id=83
/dev/sdb13: start= 24691968, size=  6570522, Id=83

我能夠掛載 sdb 1、5、7、8、9、10、11、12 的 EXT3 檔案系統,並將每個檔案系統的內容儲存到 sdb1.tar、sdb5.tar 等。

我還完成了dd if=/dev/sdb of=./sdb_dd bs=512 count=1將驅動器的 MBR 保存到名為sdb_dd.

答案1

因此,如果您只想備份整個磁碟,則無需安裝每個單獨的分割區並壓縮資料。正如@Christopher所說,你可以使用像clonezilla這樣的東西。您也可以使用 DD 備份到檔案或逐字節複製到新磁碟。 DD 的優點是它是一個標準的 GNU 實用程序,幾乎在每個 *nix 發行版上都可用。

以下假設您啟動至活動磁碟/未在要複製的磁碟上執行的其他 Linux 作業系統。此外假設您要備份的磁碟是/dev/sdb。

儲存在備份映像/檔案中

備份

dd if=/dev/sdb | gzip -c /location_to_store_backup_image/myserver.img.gz

恢復

gunzip -c /location_to_store_backup_image/myserver.img.gz | dd of=/dev/sdb

直接到其他磁碟

備份

dd if=/dev/sdb of=/dev/sdb

恢復

將複製的磁碟插入盒子並啟動系統=D

來源

http://www.linuxweblog.com/dd-image

相關內容