리눅스
dd를 사용하여 디스크의 읽기/쓰기 속도를 측정하는 방법
변군이글루
2023. 4. 5. 13:38
반응형
dd를 사용하여 디스크의 읽기/쓰기 속도를 측정하는 방법
dd 명령어는 간단하게 디스크의 읽기 및 쓰기 성능을 테스트할 수 있는 유용한 도구입니다.
1. 디스크 쓰기 속도 측정
임의의 1GB 크기의 데이터를 /tmp/testfile에 쓰면서 속도를 측정합니다.
dd if=/dev/zero of=/tmp/testfile bs=1M count=1024 oflag=direct
- if=/dev/zero → 입력 파일로 /dev/zero(0값을 가진 가상 파일) 사용
- of=/tmp/testfile → 데이터를 /tmp/testfile에 저장
- bs=1M → 1MB 블록 크기로 데이터 쓰기
- count=1024 → 1024개의 블록을 사용 (1GB)
- oflag=direct → 캐시를 사용하지 않고 직접 디스크에 쓰기
$ dd if=/dev/zero of=/tmp/testfile bs=1M count=1024 oflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.5453 s, 93.0 MB/s
- 쓰기 속도 : 93.0MB/s
2. 디스크 읽기 속도 측정
방금 생성한 /tmp/testfile을 읽으면서 속도를 측정합니다.
dd if=/tmp/testfile of=/dev/null bs=1M count=1024 iflag=direct
- if=/tmp/testfile → 입력 파일로 /tmp/testfile 사용
- of=/dev/null → 데이터를 /dev/null로 버림 (디스크 쓰기 방지)
- bs=1M → 1MB 블록 크기 사용
- count=1024 → 1GB 데이터 읽기
- iflag=direct → 캐시를 사용하지 않고 직접 디스크에서 읽기
$ dd if=/tmp/testfile of=/dev/null bs=1M count=1024 iflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.70243 s, 188 MB/s
- 읽기 속도 : 188MB/s
3. RAM 캐시를 사용한 읽기 속도 측정 (캐시된 성능 확인)
dd if=/tmp/testfile of=/dev/null bs=1M count=1024
- iflag=direct 없이 실행하면 운영 체제의 캐시를 사용하여 읽기 속도를 측정합니다.
- 일반적으로 이 방식이 더 빠르게 측정됩니다.
4. 디스크 전체 성능 측정 (랜덤 데이터 쓰기/읽기)
운영 중인 디스크의 실제 성능을 측정하려면 if=/dev/urandom을 사용하여 랜덤 데이터를 쓰는 것이 좋습니다.
쓰기 테스트(랜덤 데이터)
dd if=/dev/urandom of=/tmp/testfile bs=1M count=1024 oflag=direct
- if=/dev/urandom → 임의의 데이터를 생성하여 디스크에 기록
$ dd if=/dev/urandom of=/tmp/testfile bs=1M count=1024 oflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 47.8186 s, 22.5 MB/s
읽기 테스트(랜덤 데이터)
dd if=/tmp/testfile of=/dev/null bs=1M count=1024 iflag=direct
$ dd if=/tmp/testfile of=/dev/null bs=1M count=1024 iflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.59039 s, 192 MB/s
참고URL
- dd 명령어 : https://scbyun.com/394
dd if =/dev/urandom of =/tmp/testfile bs = 1m count = 1024 oflag = direct
728x90
반응형