Hướng dẫn tạo image limit quota folder trong centos

04/06/2020 730

1. Tạo folder mount point

mkdir /test

2. Tạo file image (vd ở đây em tạo 100M)

touch /var/virtual_disks/directory_with_size_limit.ext4
dd if=/dev/zero of=/var/virtual_disks/directory_with_size_limit.ext4 bs=100M count=1

3. Fortmat disk

mkfs.ext4 /var/virtual_disks/directory_with_size_limit.ext4

4. mount image vào folder

mount -o loop,rw,usrquota,grpquota /var/virtual_disks/directory_with_size_limit.ext3 /test

5. Thêm dung lượng

umount /test
e2fsck -f /var/virtual_disks/directory_with_size_limit.ext4
resize2fs -p /var/virtual_disks/directory_with_size_limit.ext4 NEW_SIZE
mount -o loop,rw,usrquota,grpquota /var/virtual_disks/directory_with_size_limit.ext4 /test

6.Auto mount trong /etc/fstab

/var/virtual_disks/directory_with_size_limit.ext4  /test  ext4   0  1

Chúc các bạn thành công