Jmnote bot (토론 | 기여) 잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight )) |
|||
(사용자 2명의 중간 판 10개는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
;리눅스 원하는 크기 파일 생성 | ;리눅스 원하는 크기 파일 생성 | ||
;리눅스 지정 크기 파일 생성 | |||
;리눅스 특정 크기 파일 생성 | |||
;리눅스 원하는 크기 파일 만들기 | ;리눅스 원하는 크기 파일 만들기 | ||
;리눅스 대용량 파일 생성 | ;리눅스 대용량 파일 생성 | ||
;원하는 크기의 파일 만들기 | |||
==방법 1: fallocate== | ==방법 1: fallocate== | ||
< | <syntaxhighlight lang='bash'> | ||
fallocate -l 크기 파일명 | fallocate -l 크기 파일명 | ||
</ | </syntaxhighlight> | ||
;실행예시 (100바이트) | ;실행예시 (100바이트) | ||
< | <syntaxhighlight lang='console'> | ||
[root@ | [root@zetawiki test]# fallocate -l 100 test.txt | ||
[root@ | [root@zetawiki test]# ll test.txt | ||
-rw-r--r--. 1 root root 100 Feb 5 08:37 test.txt | -rw-r--r--. 1 root root 100 Feb 5 08:37 test.txt | ||
</ | </syntaxhighlight> | ||
;실행예시 (10GB) | ;실행예시 (10GB) | ||
< | <syntaxhighlight lang='console'> | ||
[root@ | [root@zetawiki test]# fallocate -l 10G test.txt | ||
[root@ | [root@zetawiki test]# ll -h test.txt | ||
-rw-r--r--. 1 root root 10G Feb 5 08:37 test.txt | -rw-r--r--. 1 root root 10G Feb 5 08:37 test.txt | ||
</ | </syntaxhighlight> | ||
==방법 | ==방법 2: dd #1== | ||
< | <syntaxhighlight lang='bash'> | ||
dd if=/dev/zero of=파일명 bs=1 count=0 seek=크기 | dd if=/dev/zero of=파일명 bs=1 count=0 seek=크기 | ||
</ | </syntaxhighlight> | ||
;실행예시 (10GB) | ;실행예시 (10GB) | ||
< | <syntaxhighlight lang='console'> | ||
[root@ | [root@zetawiki test]# dd if=/dev/zero of=test.txt bs=1 count=0 seek=10G | ||
0+0 records in | 0+0 records in | ||
0+0 records out | 0+0 records out | ||
0 bytes (0 B) copied, 1.719e-05 s, 0.0 kB/s | 0 bytes (0 B) copied, 1.719e-05 s, 0.0 kB/s | ||
[root@ | [root@zetawiki test]# ll -h test.txt | ||
-rw-r--r--. 1 root root 10G Feb 5 09:11 test.txt | -rw-r--r--. 1 root root 10G Feb 5 09:11 test.txt | ||
</ | </syntaxhighlight> | ||
==방법 | ==방법 3: dd #2== | ||
< | <syntaxhighlight lang='bash'> | ||
dd if=/dev/zero of=파일명 count=변수1 bs=변수2 | dd if=/dev/zero of=파일명 count=변수1 bs=변수2 | ||
</ | </syntaxhighlight> | ||
:→ 변수1 × 변수2 바이트의 파일이 생성됨 | :→ 변수1 × 변수2 바이트의 파일이 생성됨 | ||
;실행예시 (1000 바이트) | ;실행예시 (1000 바이트) | ||
< | <syntaxhighlight lang='console'> | ||
[root@ | [root@zetawiki test]# dd if=/dev/zero of=text.txt count=1000 bs=1 | ||
1000+0 records in | 1000+0 records in | ||
1000+0 records out | 1000+0 records out | ||
1000 bytes (1.0 kB) copied, 0.00432457 s, 231 kB/s | 1000 bytes (1.0 kB) copied, 0.00432457 s, 231 kB/s | ||
</ | </syntaxhighlight> | ||
;실행예시 (100000 바이트) | ;실행예시 (100000 바이트) | ||
< | <syntaxhighlight lang='console'> | ||
[root@ | [root@zetawiki test]# dd if=/dev/zero of=text.txt count=1000 bs=100 | ||
1000+0 records in | 1000+0 records in | ||
1000+0 records out | 1000+0 records out | ||
100000 bytes (100 kB) copied, 0.00480996 s, 20.8 MB/s | 100000 bytes (100 kB) copied, 0.00480996 s, 20.8 MB/s | ||
</ | </syntaxhighlight> | ||
==같이 보기== | ==같이 보기== | ||
*[[fallocate]] | *[[리눅스 스왑 파일 생성]] | ||
*[[dd]] | *[[리눅스 fallocate]] | ||
*[[리눅스 dd]] | |||
*[[리눅스 touch]] | |||
*[[/dev/zero]] | *[[/dev/zero]] | ||
[[분류: 리눅스]] | [[분류: 리눅스]] | ||
[[분류: 파일]] | [[분류: 파일]] |
2021년 4월 22일 (목) 00:45 기준 최신판
- 리눅스 원하는 크기 파일 생성
- 리눅스 지정 크기 파일 생성
- 리눅스 특정 크기 파일 생성
- 리눅스 원하는 크기 파일 만들기
- 리눅스 대용량 파일 생성
- 원하는 크기의 파일 만들기
1 방법 1: fallocate[ | ]
Bash
Copy
fallocate -l 크기 파일명
- 실행예시 (100바이트)
Console
Copy
[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
- 실행예시 (10GB)
Console
Copy
[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
2 방법 2: dd #1[ | ]
Bash
Copy
dd if=/dev/zero of=파일명 bs=1 count=0 seek=크기
- 실행예시 (10GB)
Console
Copy
[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
3 방법 3: dd #2[ | ]
Bash
Copy
dd if=/dev/zero of=파일명 count=변수1 bs=변수2
- → 변수1 × 변수2 바이트의 파일이 생성됨
- 실행예시 (1000 바이트)
Console
Copy
[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
- 실행예시 (100000 바이트)
Console
Copy
[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
4 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.