fdisk –l 查看磁盘
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id System
/dev/sda1   *           1          13      104391   83 Linux
/dev/sda2              14        2610    20860402+ 8e Linux LVM
 
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdb doesn't contain a valid partition table
 
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdc doesn't contain a valid partition table
 
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sde doesn't contain a valid partition table
[root@xiaofan ~]# fdisk -l
 
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id System
/dev/sda1   *           1          13      104391   83 Linux
/dev/sda2              14        2610    20860402+ 8e Linux LVM
 
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdb doesn't contain a valid partition table
 
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdc doesn't contain a valid partition table
 
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sdd doesn't contain a valid partition table
 
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Disk /dev/sde doesn't contain a valid partition table
[root@xiaofan ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
 
 
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
2、Fdisk /dev/sdb…e 分别对bcde创建分区
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
[root@xiaofan ~]#
fdisk –l 分区后的硬盘
 
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id System
/dev/sda1   *           1          13      104391   83 Linux
/dev/sda2              14        2610    20860402+ 8e Linux LVM
 
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id System
/dev/sdb1               1        2610    20964793+ 83 Linux
 
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id System
/dev/sdc1               1        2610    20964793+ 83 Linux
 
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id System
/dev/sdd1               1        2610    20964793+ 83 Linux
 
Disk /dev/sde: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id System
/dev/sde1               1        2610    20964793+ 83 Linux
创建raid10
[root@xiaofan ~]# mdadm --create --auto=yes /dev/md10 --level=10 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
mdadm: array /dev/md10 started.
 
mdadm --detail /dev/md10 查看raid10
/dev/md10:
        Version : 0.90
 Creation Time : Fri Jan 4 21:31:53 2013
     Raid Level : raid10
     Array Size : 41929344 (39.99 GiB 42.94 GB)
 Used Dev Size : 20964672 (19.99 GiB 21.47 GB)
   Raid Devices : 4
 Total Devices : 4
Preferred Minor : 10
    Persistence : Superblock is persistent
 
    Update Time : Fri Jan 4 21:31:53 2013
          State : clean, resyncing
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
 Spare Devices : 0
 
         Layout : near=2
     Chunk Size : 64K
 
 Rebuild Status : 7% complete
 
           UUID : 75e59dae:bf5026fa:7ce22985:cf90b75b
         Events : 0.1
 
    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8       49        2      active sync   /dev/sdd1
       3       8       65        3      active sync   /dev/sde1
创建逻辑卷pvcreate /dev/md10
 Physical volume "/dev/md10" successfully created
You have mail in /var/spool/mail/root
[root@xiaofan ~]# pvdisplay 查看逻辑卷
 --- Physical volume ---
 PV Name               /dev/sda2
 VG Name               VolGroup00
 PV Size               19.89 GB / not usable 19.49 MB
 Allocatable           yes (but full)
 PE Size (KByte)       32768
 Total PE              636
 Free PE               0
 Allocated PE          636
 PV UUID               dKtlbA-1xfn-UoNc-33QI-nOIS-EdQd-z3dESY
  
 "/dev/md10" is a new physical volume of "39.99 GB"
 --- NEW Physical volume ---
 PV Name               /dev/md10
 VG Name              
 PV Size               39.99 GB
 Allocatable           NO
 PE Size (KByte)       0
 Total PE              0
 Free PE               0
 Allocated PE          0
 PV UUID               eG1GgL-3w4g-aCPq-ajG0-cuIV-2wSS-WsC4J4
[root@xiaofan ~]# vgcreate -s 16M vgroup /dev/md10创建卷组vgroup由md10组成pv为16m
 /dev/cdrom: open failed: 只读文件系统
 /dev/cdrom: open failed: 只读文件系统
 Attempt to close device '/dev/cdrom' which is not open.
 Volume group "vgroup" successfully created
lvcreate -l 200 -n lv vgroup在vgroup卷组创建lv指定pe个数为200
 Logical volume "lv" created
[root@xiaofan ~]# mkfs.ext3 /dev/vgroup/lv 格式化lv
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
409600 inodes, 819200 blocks
40960 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=838860800
25 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912
 
Writing inode tables: done                           
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@xiaofan ~]#
[root@xiaofan ~]# lvdisplay /dev/vgroup/lv查看指定lv使用3.12G
 --- Logical volume ---
 LV Name                /dev/vgroup/lv
 VG Name                vgroup
 LV UUID                faUbEQ-bD1q-lWU8-PQqa-fPgG-y5Tt-VgIKdV
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                3.12 GB
 Current LE             200
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto
 - currently set to     512
 Block device           253:2
  
[root@xiaofan ~]# vgdisplay vgroup查看卷组vgroup使用情况
 Invalid volume group name: vgroup/
[root@xiaofan ~]# vgdisplay vgroup
 --- Volume group ---
 VG Name               vgroup
 System ID            
 Format                lvm2
 Metadata Areas        1
 Metadata Sequence No 2
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                1
 Open LV               0
 Max PV                0
 Cur PV                1
 Act PV                1
 VG Size               39.98 GB
 PE Size               16.00 MB
 Total PE              2559
 Alloc PE / Size         200 / 3.12 GB 使用的lv
 Free PE / Size        2359 / 36.86 GB剩余大小
 VG UUID               uZ1b6P-pgZs-StTG-bUx2-Yz7n-3XkP-GOCfnx
  
[root@xiaofan ~]# umount /mnt
umount: /mnt: not mounted
[root@xiaofan ~]# umount /mnt
umount: /mnt: not mounted
[root@xiaofan ~]# cd /mnt
[root@xiaofan mnt]# ls
hgfs
[root@xiaofan mnt]# mount /dev/vgroup/lv /mnt
[root@xiaofan mnt]# cd /mnt
[root@xiaofan mnt]# ls
lost+found
[root@xiaofan mnt]# cd
mount -o remount,usrquota,grpquota /mnt
[root@xiaofan ~]# vi /etc/fstab
[root@xiaofan ~]# umount /mnt
[root@xiaofan mnt]# mount –a
 vi /etc/mdadm.conf
ARRAY /dev/md10 UUID= 75e59dae:bf5026fa:7ce22985:cf90b75b6 vi /etc/fstab
 vi /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts gid=5,mode=620 0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/vgroup/lv           /mnt                    ext3     defaults,usrquota,grpquota 0 0      
[root@xiaofan ~]# quotacheck -auvg
quotacheck: Scanning /dev/mapper/vgroup-lv [/mnt]
quotacheck: Cannot stat old user quota file: 没有那个文件或目录
quotacheck: Cannot stat old group quota file: 没有那个文件或目录
quotacheck: Cannot stat old user quota file: 没有那个文件或目录
quotacheck: Cannot stat old group quota file: 没有那个文件或目录
done
quotacheck: Checked 3 directories and 2 files
quotacheck: Old file not found.
quotacheck: Old file not found.
[root@xiaofan ~]# quotaon -auvg
/dev/mapper/vgroup-lv [/mnt]: group quotas turned on
/dev/mapper/vgroup-lv [/mnt]: user quotas turned on
[root@xiaofan ~]# useradd test
[root@xiaofan ~]# passwd test
Changing password for user test.
New UNIX password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@xiaofan ~]# edquota -u test
edquota: Bad format:
 /dev/mapper/vgroup-lv             0          1024         2048       0        0        0
 
edquota: Can't read quotas from file.
dd if=/dev/zero of=/mnt/1.txt block=1M count=2 测试输入1m2次
[test@xiaofan mnt]$ dd if=/dev/zero pf=/mnt/1.txt bs=1M count=1
dd: unrecognized operand “pf”=“/mnt/1.txt”
请尝试执行“dd --help”来获取更多信息。
[test@xiaofan mnt]$ dd if=/dev/zero of=/mnt/1.txt bs=1M count=1
dm-2: warning, user block quota exceeded.
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0303965 seconds, 34.5 MB/s
[test@xiaofan mnt]$ dd if=/dev/zero of=/mnt/1.txt bs=1M count=2
dm-2: warning, user block quota exceeded.
dm-2: write failed, user block limit reached.
dd: 写入 “/mnt/1.txt”: 超出磁盘限额