UNIX/Redhat

[스크랩] 리눅스 대용량 파일 생성

99iberty 2020. 6. 30. 10:56

https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%EB%8C%80%EC%9A%A9%EB%9F%89_%ED%8C%8C%EC%9D%BC_%EC%83%9D%EC%84%B1

 

리눅스 대용량 파일 생성 - 제타위키

다음 문자열 포함...

zetawiki.com

 

리눅스 원하는 크기 파일 생성리눅스 지정 크기 파일 생성리눅스 특정 크기 파일 생성리눅스 원하는 크기 파일 만들기리눅스 대용량 파일 생성원하는 크기의 파일 만들기

목차

1 방법 1: fallocate[편집]

fallocate -l 크기 파일명 ✂️

Bash

실행예시 (100바이트)

[root@zetawiki test]# fallocate -l 100 test.txt [root@zetawiki test]# ll test.txt -rw-r--r--. 1 root root 100 Feb 5 08:37 test.txt ✂️

console

실행예시 (10GB)

[root@zetawiki test]# fallocate -l 10G test.txt [root@zetawiki test]# ll -h test.txt -rw-r--r--. 1 root root 10G Feb 5 08:37 test.txt ✂️

console

2 방법 3: dd (1)[편집]

dd if=/dev/zero of=파일명 bs=1 count=0 seek=크기 ✂️

Bash

실행예시 (10GB)

[root@zetawiki test]# dd if=/dev/zero of=test.txt bs=1 count=0 seek=10G 0+0 records in 0+0 records out 0 bytes (0 B) copied, 1.719e-05 s, 0.0 kB/s [root@zetawiki test]# ll -h test.txt -rw-r--r--. 1 root root 10G Feb 5 09:11 test.txt ✂️

console

3 방법 2: dd (2)[편집]

dd if=/dev/zero of=파일명 count=변수1 bs=변수2 ✂️

Bash

→ 변수1 × 변수2 바이트의 파일이 생성됨실행예시 (1000 바이트)

[root@zetawiki test]# dd if=/dev/zero of=text.txt count=1000 bs=1 1000+0 records in 1000+0 records out 1000 bytes (1.0 kB) copied, 0.00432457 s, 231 kB/s ✂️

console

실행예시 (100000 바이트)

[root@zetawiki test]# dd if=/dev/zero of=text.txt count=1000 bs=100 1000+0 records in 1000+0 records out 100000 bytes (100 kB) copied, 0.00480996 s, 20.8 MB/s ✂️

console

4 같이 보기[편집]