linux下添加新硬盘设备和硬盘分区格式化挂载使用磁盘配额限制

来源:岁月联盟 编辑:exp 时间:2012-06-29
linux下添加新硬盘设备和硬盘分区格式化挂载使用磁盘配额限制 磁盘管理1、查看硬盘设备信息fdisk -l 2、磁盘分区、格式化、挂载使用  www.2cto.com  1)、查看硬盘信息:fdisk -l [root@localhost ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 6 48163+ 83 Linux/dev/sda2 7 515 4088542+ 83 Linux/dev/sda3 516 2480 15783862+ 83 Linux/dev/sda4 2481 2610 1044225 5 Extended/dev/sda5 2481 2610 1044193+ 82 Linux swap / Solaris  www.2cto.com  Disk /dev/sdb: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sdb1 1 2610 20964793+ 5 Extended/dev/sdb5 1 2610 20964762 83 LinuxWarning: invalid flag 0x0000 of partition table 5 will be corrected by w(rite) Disk /dev/sdc: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes  www.2cto.com  Device Boot Start End Blocks Id System/dev/sdc1 11 5221 41857357+ 5 Extended/dev/sdc4 1 10 80293+ 83 Linux 2)、对硬盘分区 fdisk /dev/sdb E.g.: fdisk /dev/hda (for the first IDE disk)or: fdisk /dev/sdc (for the third SCSI disk)or: fdisk /dev/eda (for the first PS/2 ESDI drive)Command action l list known partition types n add a new partition  www.2cto.com  p print the partition tableq quit without saving changes t change a partition's system idu change display/entry units w write table to disk and exit  www.2cto.com  3)、n 创建新分区 [d 是删除一个分区] 4)、 e---创建扩展分区--->l 创建逻辑分区p---创建主分区 填入起始柱面 和 结束柱面 5)、t设置文件系统号 83 --->linux  6)、w 将分区信息写入分区表 【 or q 退出,不写入】  7)、 格式化为ext3 ----->mkfs.ext3 /dev/sdb58)、partprobe /dev/sdb 通知所有软件 有该硬盘设备 9)、设置自动挂载vi /etc/fstab/dev/sdb5 /mnt ext3 defaults 0 010)、挂载fstab文件中没有挂载的设备 mount -a  11)、df -h 查看已经挂载的所有设备 磁盘配额限制: 1、 添加一块新磁盘 ,分区 、格式化 、(mkfs.etx3 /dev/sdc5/) 2、设置开机自动挂载(vi /etc/fstab) 添加磁盘配额支持 (用户配额usrquota、组配额grpquota)/dev/sdc5 /mnt ext3 defaults,usrquota,grpquota 0 0 3、mount -a /dev/sdc5 挂载磁盘  4、在挂载点下面生成配额数据库quotacheck -cumg /mnt  www.2cto.com  [root@localhost mnt]# lltotal 16-rw------- 1 root root 6144 Jun 16 05:21 aquota.group-rw------- 1 root root 6144 Jun 16 05:21 aquota.user 5、编辑用户配额和组配额 edquota -u user1 or edquota -g web 这里是之整个组只能用限额之内的还是组内每个人都能用那么多? 6、开启磁盘配额限制 quotaon -aug  7、测试 dd if=/dev/zero of=test.txt bs=10M count=2  作者 zdrjlamp