Linux/RedHat, CentOS, ubuntu

[ Linux ] fallocate 명령어 (임의크기 파일 만들기 명령어)

Pydole 2022. 2. 28. 00:46

 

백업 등 특정 파일을 가지고 테스트를 해볼 때, fallocate 명령어는 유용하게 사용할 수 있다.

 

생성된 파일내용은 없으며, 크기만 할당된다.

 

 

 

1. 10Byte 크기의 파일을 생성하기

 

$ fallocate -l 10 file           # -l : 지정한 크기만큼의 용량의 파일 만들기 (Byte)
$ ls -l file

....  .... 10 Feb 27 15:30 file

 

$ fallocate -l 10k file           # 10 kilo Bytes
$ fallocate -l 10m file           # 10 Mega Bytes
$ fallocate -l 10g file           # 10 Giga Bytes