OS 기술/Linux
dd 명령어를 이용한 더미파일 생성
DongT
2023. 7. 15. 02:15
728x90
반응형
dd 명령어는 일반적으로 백업,복원에 사용하지만 더미파일 만들때도 많이 사용함.
더미파일 : 용량만 존재하는 빈 파일
- 명령어 양식
dd if=/dev/zero of=[파일명] count=[블록수] bs=[블록사이즈]
예시) 1Gfile이라는 이름의 1GB용량 파일 생성
# dd if=/dev/zero of=1Gfile.txt count=1024 bs=1024k 1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB) copied, 0.581207 s, 1.8 GB/s # ls -lh 1Gfile.txt -rw-r--r--. 1 root root 1.0G Dec 7 13:06 1Gfile.txt |
참고)) count 크기가 커질수록 파일생성에 시간이 더 소요됨
1GB 파일 생성시 옵션값 변화에 따른 속도차이
# dd if=/dev/zero of=1Gfile.txt count=1024 bs=1024k 1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB) copied, 0.581207 s, 1.8 GB/s 블록수 1024개 -> 0.5초 소요 # dd if=/dev/zero of=1Gfile.txt count=10240 bs=104k 10240+0 records in 10240+0 records out 1090519040 bytes (1.1 GB) copied, 1.30477 s, 836 MB/s 블록수 10240개 -> 1.3초 소요 # dd if=/dev/zero of=1Gfile.txt count=102400 bs=10k 102400+0 records in 102400+0 records out 1048576000 bytes (1.0 GB) copied, 1.61476 s, 649 MB/s 블록수 102400개 -> 1.6초 소요 # dd if=/dev/zero of=1Gfile.txt count=1024000 bs=1k 1024000+0 records in 1024000+0 records out 1048576000 bytes (1.0 GB) copied, 3.59944 s, 291 MB/s 블록수 1024000개 -> 3.5초 소요 |
728x90