Linux新建指定文件数量限额的目录

参考文章

https://blog.csdn.net/weixin_28848317/article/details/116647116?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-116647116-blog-54933188.235%5Ev38%5Epc_relevant_default_base&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-116647116-blog-54933188.235%5Ev38%5Epc_relevant_default_base&utm_relevant_index=1

执行指令

[root@centos7 ~]# cd /opt
[root@centos7 opt]# dd if=/dev/zero of=test.img bs=10M count=1
1+0 records in
1+0 records out
10485760 bytes (10 MB) copied, 0.0209482 s, 501 MB/s
[root@centos7 opt]#
[root@centos7 opt]#
[root@centos7 opt]# losetup -f
/dev/loop0
[root@centos7 opt]# losetup /dev/loop0 test.img
[root@centos7 opt]#
[root@centos7 opt]# mkfs.ext4 /dev/loop0 -N 5
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
16 inodes, 10240 blocks
512 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=10485760
2 block groups
8192 blocks per group, 8192 fragments per group
8 inodes per group
Superblock backups stored on blocks:
        8193

Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

[root@centos7 opt]# losetup -d /dev/loop0
[root@centos7 opt]# cd /mnt/rui
[root@centos7 rui]# mkdir test
[root@centos7 opt]# mount -o loop test.img /mnt/rui/test/
[root@centos7 opt]#
[root@centos7 opt]# cd /mnt/rui/test
[root@centos7 test]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G  320K  1.9G   1% /dev/shm
tmpfs                    1.9G   93M  1.8G   5% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   90G   48G   43G  53% /
/dev/sda1                4.0G  197M  3.8G   5% /boot
tmpfs                    378M     0  378M   0% /run/user/1000
tmpfs                    378M     0  378M   0% /run/user/0
overlay                   90G   48G   43G  53% /var/lib/docker/overlay2/da83d894ebfb5eb7641a578a4f53b6
/dev/loop0               9.0M  172K  8.2M   3% /mnt/rui/test
[root@centos7 opt]#
[root@centos7 opt]#
[root@centos7 test]# df -i
Filesystem                Inodes  IUsed    IFree IUse% Mounted on
devtmpfs                  479649    360   479289    1% /dev
tmpfs                     482660      2   482658    1% /dev/shm
tmpfs                     482660   1456   481204    1% /run
tmpfs                     482660     16   482644    1% /sys/fs/cgroup
/dev/mapper/centos-root 47183872 748812 46435060    2% /
/dev/sda1                2097152    334  2096818    1% /boot
tmpfs                     482660      1   482659    1% /run/user/1000
tmpfs                     482660      1   482659    1% /run/user/0
overlay                 47183872 748812 46435060    2% /var/lib/docker/overlay2/da83d894ebfb5eb7641a57a/merged
/dev/loop0                    16     11        5   69% /mnt/rui/test

你可能感兴趣的:(linux,运维,服务器)