ext3是由开放资源社区开发的日志文件系统,ext3被设计成是ext2的升级版本,ext3在ext2的基础上加入了记录元数据的日志功能,努力保持向前和向后的兼容性。这个文件系统被称为ext2的下一个版本。
ext3fs最大的优点是向下兼容ext2,而且ext3fs还支持异步的日志,这意味着它的性能可能比ext2还好。但是使用ext3文件系统时不支持磁盘限量功能。
red hat从kernel2.4.17-pre8以后支持ext3的磁盘quota,我选择了更为稳定的kernel2.4.18来实现。
<1.源文件>
kernel-2.4.18:http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.18.tar.gz
quota:ftp://ftp.rpmfind.net/linux/redhat/7.3/en/os/i386/RedHat/RPMS/quota-3.03-1.i386.rpm
把档案放在/home/src下
2-1-2)kernel升级过程:
#cd /home/src
#mkdir kernel_update
#cp ./linux-2.4.18.tar.gz ./kernel_update
#cd kernel_update
#tar zxvf linux-2.4.18.tar.gz
#cd linux
#make menuconfig
此时出现Linux Kernel v2.4.18 Configuration的窗口
Processor type and features --->
General setup --->
Memory Technology Devices (MTD) --->
Parallel port support --->
Plug and Play configuration --->
Block devices --->
Multi-device support (RAID and LVM) --->
Networking options --->
Telephony Support --->
ATA/IDE/MFM/RLL support --->
SCSI support --->
Fusion MPT device support --->
I2O device support --->
Network device support --->
Amateur Radio support --->
IrDA (infrared) support --->
ISDN subsystem --->
Old CD-ROM drivers (not SCSI, not IDE) --->
Input core support --->
Character devices --->
Multimedia devices --->
File systems --->
Console drivers --->
Sound --->
USB support --->
Kernel hacking --->
---
Load an Alternate Configuration File
Save Configuration to an Alternate File
以下都是kernel里的选项,可以根据server硬件的不同自行选择
与quota有关的设定如下
找到File systems ---> 的字样 (第22行) 按空格键
把第一行的Quota support前打上*号
[*] Quota support
Kernel automounter support
Kernel automounter version 4 support (also supports v3)
Reiserfs support
Ext3 journalling file system support (EXPERIMENTAL)
[*] JBD (ext3) debugging support
DOS FAT fs support
Compressed ROM file system support
[*] Virtual memory file system support (former shm fs)
Simple RAM-based file system support
ISO 9660 CDROM file system support
[ ] Microsoft Joliet CDROM extensions
[ ] Transparent decompression extension
Minix fs support
FreeVxFS file system support (VERITAS VxFS(TM) compatible)
NTFS file system support (read only)
OS/2 HPFS file system support
[*] /proc file system support
[*] /dev/pts file system for Unix98 PTYs
ROM file system support
Second extended fs support
System V/Xenix/V7/Coherent file system support
UDF file system support (read only)
UFS file system support (read only)
Network File Systems --->
选定以后选择exit退出。
出现以下:
┌──────────────────────────────────────────────────────────┐
│ Do you wish to save your new kernel configuration? │
├──────────────────────────────────────────────────────────┤
│ │
└──────────────────────────────────────────────────────────┘
选择yes
然后出现以下字样:
Saving your kernel configuration...
*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you must run 'make dep'.
2-1-2)编译kernel
#make dep
#make clean
#make bzImage
#make modules
#make modules_install
2-1-3)cp新的kernel到启动区
#cp /home/src/kernel_update/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.18
#mkinitrd /boot/initrd-2.4.18.img 2.4.18
#vi /etc/lilo.conf
在最后添加以下
image=/boot/vmlinuz-2.4.18 <= kernel的路径
label=newkernel <= 启动时的卷标
initrd=/boot/initrd-2.4.18.img <= kernelimg的路径
read-only
root=/dev/hda2 <= / 所在的区
#/sbin/lilo -m /boot/map
2-1-4)重新启动server
#reboot
重新启动进入时在redhat lilo的选择界面选择newkernel进入
2-2)设定quota
2-2-1)安装quota。
#cd /home/src
#rpm -ivv quota-3.03-1.i386.rpm
2-2-2)设定quota,以home为例
#vi /etc/fstab
把
LABEL=/home /home ext3 defaults 1 2
改成
LABEL=/home /home ext3 defaults,usrquota,grpquota 1 2
重启server
#/sbin/reboot
2-2-3)设定用户限定
#quotacheck -uvg /home
#edquota -u test
Disk quotas for user chenc (uid 694):
Filesystem blocks soft hard inodes soft hard
/dev/hda5 6000 5000 6000 3 5000 6000
在soft和hard下添上需要限制的磁盘大小(单位是K)
#edquota -t
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
Filesystem Block grace period Inode grace period
/dev/hda5 1minutes 1minutes
设定soft quota和hard quota之间的时间。
启动quota
#quotaon -av
用test帐号用ftp进行测试,当test目录达到了5M时,提示Disk quota exceeded。