Hướng dẫn tạo image limit quota folder trong centos
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
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
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
Lênh dd củng có thể dùng để clone disk các bạn nhé vd:
dd if=/dev/sda of=/dev/sdb bs=32M
Chúc các bạn thành công.
Bình luận
Gửi