라즈베리파이에 os 설정을 어렵게 했다가 날리는 경험이 많죠~

사용하고 있는 microSD 카드를 백업하는 방법입니다.

USB 외장 하드를 /mnt/hdd 에 마운트 했다는 가정하에 dd 명령어로 압축백업하는 방법입니다.

[root@ivps ~]# dd if=/dev/mmcblk0 bs=512K | gzip -c > /mnt/hdd/raspberry-pi-centos7.img.gz
30174+0 records in
30174+0 records out
15819866112 bytes (16 GB) copied, 3289.32 s, 4.8 MB/s

백업 되고 있는 상태를 알고싶다면 status=progress 옵션을 추가하면 됩니다.

압축없이 : dd if=/dev/mmcblk0 bs=512K status=progress of=/mnt/hdd/raspberry-pi-centos7.img
압축백업 : dd if=/dev/mmcblk0 bs=512K status=progress | gzip -c > /mnt/hdd/raspberry-pi-centos7.img.gz

복원방법은 balenaEtcher 또는 rufus 같은 유틸리티로 굽는게 좋겠지만 리눅스에서 dd 명령어로는 아래와 같습니다.

dd if=/mnt/hdd/raspberry-pi-centos7.img of=/dev/mmcblk0 bs=512K
gzip -cd /mnt/hdd/raspberry-pi-centos7.img.gz | dd of=/dev/mmcblk0 bs=512K

실제 운영중인 상태에서는 에러가 발생할 수도 있습니다.

 

 

블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,