rpi-cloneを使ってUSBメモリに丸ごとバックアップ(備忘録)

テクノロジー

Rasberry Piでrpi-cloneを使ってバックアップ用のUSBメモリに環境丸ごとバックアップします。

まずは挿したUSBメモリの場所を確認。

sudo fdisk -l
Disk /dev/sdb: 14.69 GiB, 15770583040 bytes, 30801920 sectors

場所を確認したら、下記コマンドでバックアップを実行。

sudo rpi-clone sdb -f

コピー元とコピー先の詳細が表示されます。

Booted disk: sda 500.1GB                   Destination disk: sdb 15.8GB
---------------------------------------------------------------------------
Part      Size    FS     Label           Part   Size  FS  Label
1 /boot   256.0M  fat32  --
2 root    465.5G  ext4   --
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - forced by option ==
1 /boot               (51.0M used)   : MKFS  SYNC to sdb1
2 root                (7.9G used)    : RESIZE  MKFS  SYNC to sdb2
---------------------------------------------------------------------------
Run setup script       : no.
Verbose mode           : no.
-----------------------:
** WARNING **          : All destination disk sdb data will be overwritten!
-----------------------:
Initialize and clone to the destination disk sdb? (yes/no): 

と聞かれるので、yを入力。

Optional destination ext type file system label (16 chars max):

と聞かれるので、空欄でEnter。

バックアップが始まります。

Initializing
  Imaging past partition 1 start.
  => dd if=/dev/sda of=/dev/sdb bs=1M count=8 ...
  Resizing destination disk last partition ...
    Resize success.
  Changing destination Disk ID ...
  => mkfs -t vfat -F 32  /dev/sdb1 ...
  => mkfs -t ext4  /dev/sdb2 ...

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/sdb2 on /mnt/clone
  => rsync // /mnt/clone with-root-excludes ...
  Mounting /dev/sdb1 on /mnt/clone/boot
  => rsync /boot/ /mnt/clone/boot  ...

Editing /mnt/clone/boot/cmdline.txt PARTUUID to use 52330634
Editing /mnt/clone/etc/fstab PARTUUID to use 52330634
===============================
Done with clone to /dev/sdb
   Start - 14:22:46    End - 14:36:48    Elapsed Time - 14:02

Cloned partitions are mounted on /mnt/clone for inspection or customizing.

Hit Enter when ready to unmount the /dev/sdb partitions ...

Enterを押して、USBメモリを外してバックアップ完了です。

コメント

タイトルとURLをコピーしました