LoginSignup
0
0

More than 1 year has passed since last update.

Ubuntu22.04 で SDカードをコピーする

Posted at

はじめに

RaspberryPi4 のSDカードがなんか死んでる気がする。。。

そうだとりあえず、SDカードのコピーしてみよう

環境

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"

$ cat /etc/os-relase
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

$ lsusb
 :
 :
Bus 001 Device 008: ID 05e3:0751 Genesys Logic, Inc. microSD Card Reader
 :
 :

$ lsblk
 :
 :
sda           8:0    1  14.9G  0 disk 
├─sda1        8:1    1   256M  0 part 
└─sda2        8:2    1  14.6G  0 part
 :
 :

まずは元のSDカードのイメージを読み込み

$ sudo dd if=/dev/sda of=sdcard_backup.img bs=4M status=progress

新しいSDカードにイメージを書き込み

$ sudo dd if=sdcard_backup.img of=/dev/sda bs=4M status=progress
$ sudo sync

ファイルシステムのチェック

$ sudo lsblk -f
 :
 :
sda                                                                                        
├─sda1      vfat     FAT32 system-boot ****-****                                           
└─sda2      ext4     1.0   writable    ********-****-****-****-************ 
 :
 :

$ sudo dosfsck -a /dev/sda1
fsck.fat 4.2 (2021-01-31)
Reclaimed 90 unused clusters (46080 bytes) in 1 chain.
Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
 Automatically removing dirty bit.
Free cluster summary wrong (238368 vs. really 238278)
  Auto-correcting.

*** Filesystem was changed ***
Writing changes.
/dev/sda1: 747 files, 277912/516190 clusters

$ sudo e2fsck -f /dev/sda2
 :
 :
writable: ***** ファイルシステムは変更されました *****
writable: 129730/947776 files (0.2% non-contiguous), 1145114/3835131 blocks

さいごに

かんたんでしたね

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0