article thumbnail image
2022. 2. 5. 15:24
728x90

복사하고 싶은 디스크를 sda, 새 디스크를 sdb라고 하자.

여기서는 sda 보다 sdb의 크기가 같거나 큰 경우만 다룬다. (디스크 용량: sda <= sdb)
(sdb가 오히려 작은 경우에는 sda의 partition 크기를 줄이는 작업이 선행되어야 한다.)

디스크 용량 확인

$ sudo fdisk -l /dev/sda /dev/sdb
Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 960 EVO 500GB               
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 68F9EDD0-0895-4E7E-BB21-F5F224465EA0

Device           Start       End   Sectors   Size Type
/dev/sda1    2048   1050623   1048576   512M EFI System
/dev/sda2 1050624 976771071 975720448 465.3G Linux filesystem

Disk /dev/sdb: 1.84 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: ST2000DM008-2FR1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

sdb가 sda 용량보다 더 크거나 같으면 다음으로 넘어가자.

dd 명령어로 디스크 복제

$ sudo dd if=/dev/sda of=/dev/sdb status=progress

이렇게 간단한 dd 명령어로 sda를 sdb에 복제할 수 있다.
boot 파티션도 모두 복사되므로 sda를 빼고 sdb만 두어도 동일하게 부팅되는 것을 확인할 수 있다.
또한 sdb의 남는 공간은 freespace로 잡히니 해당 파티션을 포맷해서 사용 가능하다.

728x90
복사했습니다!