2012년 3월 23일 금요일

특정 크기의 파일 만들기

dd(Unix) - http://en.wikipedia.org/wiki/Dd_(Unix)

dd 명령어를 이용하여 특정 크기의 파일을 생성할 수 있다.
참고: http://darkrang.tistory.com/191
$ dd if=/dev/zero of=[생성할 파일 경로] bs=[block size] count=[개수]
예) 100 MB 크기의 testfile 이라는 이름의 파일을 생성한다.
$ dd if=/dev/zero of=/home/test-user/testfile bs=100M count=1

wiki 인용: block size 에 사용할 수 있는 단위
w means 2
b means 512
k means 1024
M specifies multiplication by 10242
G specifies multiplication by 10243

추가) 단순 파일 생성은 touch 명령어를 이용한다.
$ touch [생성할 파일 path]
예) 0 byte 크기의 testfile 이라는 이름의 파일을 생성한다.
$ touch testfile

추가) 윈도에서는 fsutil 을 이용한다. (윈도 XP 이상 지원)
참고: http://ntfaq.co.kr/2070
> fsutil file createnew [파일 이름] [파일 크기]
예) 1기가 크기의 파일 생성 (1024 x 1024 x 1024 bytes)
> fsutil file createnew c:\file1 1073741824

댓글 없음:

댓글 쓰기