본문 바로가기
server/Cent_os

dd(dsik dump) 명령어

dd 명령어는 디스크 자체를 덤프 받는 명령어로
디스크를 다른 디스크 또는 이미지로 사용이 가능하다.

[root@localhost Fri]# for i in etc boot root home
> do
> dd if=/dev/zero of=/$i/test1 bs=1024 count=1
> done
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 2.6037e-05 seconds, 39.3 MB/s
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 2.1439e-05 seconds, 47.8 MB/s
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 2.2248e-05 seconds, 46.0 MB/s
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 1.8715e-05 seconds, 54.7 MB/s

1) 일반적인 파일 복사

[root@localhost test]# dd if=/bin/ls of=ls2
182+1 records in
182+1 records out
93560 bytes (94 kB) copied, 0.000775776 seconds, 121 MB/s


2) 1바이트 파일 생성

 [root@localhost test]# dd if=/dev/zero of=zero2 bs=1 count=1
1+0 records in
1+0 records out
1 byte (1 B) copied, 2.4238e-05 seconds, 41.3 kB/s
[root@localhost test]# ls -al
total 124
drwxr-xr-x 2 root root 4096 Nov 9 05:35 .
drwxr-x--- 4 root root 4096 Nov 9 05:09 ..
-rw-r--r-- 1 root root 1 Nov 9 05:35 zero2

2) 10바이트 파일 생성

 [root@localhost test]# dd if=/dev/zero of=zero2 bs=10 count=1
1+0 records in
1+0 records out
1 byte (1 B) copied, 2.4238e-05 seconds, 41.3 kB/s
[root@localhost test]# ls -al
total 124
drwxr-xr-x 2 root root 4096 Nov 9 05:35 .
drwxr-x--- 4 root root 4096 Nov 9 05:09 ..
-rw-r--r-- 1 root root 10 Nov 9 05:35 zero2

3) 파티션 이미지 생성

 [root@localhost test]# dd if=/dev/sda1 of=boot.img bs=1024


4) 파티션 이미지 마운트

[root@localhost test]#  mount -o loop boot.img /bootdir


[일반 마운트와 다르게  -o loop 옵션을 붙여줘야 한다=>일반파일의 마운트 가능]

 

 

반응형

'server > Cent_os' 카테고리의 다른 글

glusterfs3.5 설치  (0) 2015.05.27
zlib install(1.2.8)  (0) 2015.05.27
브릿지 방화벽 구축  (0) 2013.02.09
Centos 4.x 계열의 yum 실행 오류시 해결책  (0) 2013.02.09
swap 영역 추가  (0) 2013.02.09