리눅스 대용량 파일 생성

Jmnote (토론 | 기여)님의 2014년 2월 6일 (목) 01:40 판 (새 문서: ;리눅스 원하는 크기 파일 생성 ;리눅스 원하는 크기 파일 만들기 ==방법 1: fallocate== <source lang='bash'> fallocate -l 크기 파일명 </source> ;실행...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
리눅스 원하는 크기 파일 생성
리눅스 원하는 크기 파일 만들기

1 방법 1: fallocate

Bash
Copy
fallocate -l 크기 파일명
실행예시 (100바이트)
bat
Copy
[root@jmnote test]# fallocate -l 100 test.txt
[root@jmnote test]# ll test.txt
-rw-r--r--. 1 root root 100 Feb  5 08:37 test.txt
실행예시 (10GB)
bat
Copy
[root@jmnote test]# fallocate -l 10G test.txt
[root@jmnote test]# ll -h test.txt
-rw-r--r--. 1 root root 10G Feb  5 08:37 test.txt

2 방법 2: dd

Bash
Copy
dd if=/dev/zero of=파일명 count=변수1 bs=변수2
→ 변수1 × 변수2 바이트의 파일이 생성됨
실행예시 (100 바이트)
bat
Copy
[root@jmnote test]# dd if=/dev/zero of=text.txt count=100 bs=1
100+0 records in
100+0 records out
100 bytes (100 B) copied, 0.000491544 s, 203 kB/s
실행예시 (1000 바이트)
bat
Copy
[root@jmnote test]# dd if=/dev/zero of=text.txt count=100 bs=10
100+0 records in
100+0 records out
1000 bytes (1.0 kB) copied, 0.000411376 s, 2.4 MB/s

3 같이 보기