Direct Disk-to-Disk Copy on Linux

Posted at 2008/09/18 14:57 // in Tips // by Daniel

(해본 것은 아님. 앞으로 하기 위해 남겨두는 자료)

디스크 내용을 그대로 복사할 때.

http://www.linuxplanet.com/linuxplanet/tutorials/986/4/

1. 아래 명령을 쓰면 된다.

# dd if=/dev/hda of=/dev/hdb bs=1024k

if -> 이전 디스크

of -> 새 디스크

그대로 카피한다.

bs -> 블럭 사이즈. (안해봤으니 주의!)

the blocksize, which depends on the disk's cache, but typical figures would be 64k on a small modern IDE to 2048k on a ultrawide SCSI with much larger cache

--> disk 캐시에 관련된다고 한다.

/dev/hda, /dev/sda 등인지는 자기 시스템 맞춰서 볼 것. 다음 명령으로 알 수 있음.

sudo fdisk -l

SATA가 붙은 내 시스템의 경우는 /dev/sda

$ sudo fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x15e915e8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          24      192748+  83  Linux
/dev/sda2              25       11695    93747307+  83  Linux
/dev/sda3           14840       30401   125001765   83  Linux
/dev/sda4           11696       14839    25254180    5  Extended
/dev/sda5           11696       12181     3903763+  82  Linux swap / Solaris
/dev/sda6           12182       14839    21350353+  83  Linux

Partition table entries are not in disk order

 

2. 일단 리부트해서 깨끗하게 까먹어주고

(아직 디스크 옮겨 달지 말고)

디스크 체크

fsck -y /dev/hdb1

마운트 한 다음

mount /dev/hdb1 /target

/target/etc/hostname, /target/etc/init.d/network 등을 수정해서 세 설정에 맞춰준다.

lilo -v -r /target

lilo로 부팅 설정 제대로 해주고 (grub에서 어떻게 되는 지 모르겠다. 나는 부팅이 안된다면 ubuntu live CD로 부팅시켜 부트로더를 인스톨할 생각)

(부트 섹터는 디스크 앞에 있으니, ( dd if=/dev/hda of=backup.boot bs=512 count=1 같은 명령으로 복사함)

아마 아까 처음에 카피한 것으로 부트로더도 들어가있을 것..)

마지막으로 sync로 써준 내용들이 잘 들어가도록 한다.

sync
크리에이티브 커먼즈 라이센스
Creative Commons License