Friday, June 24, 2011

Create a file with mkfile or dd

Now assume you want to create a file with 10M space:
Under Solaris:
root@beisoltest02 / # mkfile 10m disk1.img
root@beisoltest02 / # ls -lh disk1.img -rw——T 1 root root 10M Jun 22 00:41 disk1.img

Under Linux:
[root@beivcs02 downloads]#

Tạo File 10Mb

dd if=/dev/zero of=disk1.img bs=1024k count=10

Tạo file 10GB

dd if=/dev/zero of=disk1.img bs=1024k count=10240


10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.01096 seconds, 957 MB/s
[root@beivcs02 downloads]# ls -lh disk1.img
-rw-r–r– 1 root root 10M Jun 22 00:37 disk1.img

No comments: