インフラエンジニアの技術ブログ

日々学んでいることをブログでまとめていきます。

備忘:巨大ファイルを作成するコマンド

環境はcentos

以下は1Gのファイルkyodai.logを作成するコマンド

fallocate 1G kyodai.log

[root@centos work]# pwd
/root/work
[root@centos work]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@centos work]# ls

### オプションをつけないと失敗 ###
[root@centos work]# fallocate 1G kyodai.log
fallocate: no length argument specified
[root@centos work]# fallocate -l 1G kyodai.log
[root@centos work]# ls -l
合計 1048580
-rw-r--r-- 1 root root 1073741824 12月 15 23:09 2018 kyodai.log
[root@centos work]# ls -lh
合計 1.1G
-rw-r--r-- 1 root root 1.0G 12月 15 23:09 2018 kyodai.log