Linux系统中的系统分区管理


存储是每个计算机系统的基本需求 .Red Hat Linux 提供了一些强大的工具 , 它们能在大量的场景中管理多种类型的存储设备

本地存储设备的区别

fdisk -l              #列出磁盘分区信息,系统中真实存在的硬盘,但是不一定能够识别
cat /proc/partitions  #系统识别也不一定能用
blkid                 #列出系统中可以使用的设备id,能够识别,也能够使用的
df                    #查看系统中正在使用的设备信息,系统正在挂载的设备

fdisk -l        

    

cat /proc/partitions

blkid     

           

df                 
 
  

设备的挂载和卸载

1.设备名称

/dev/xdx         ##/dev/hd0  /dev/hd1 /dev/sda  /dev/sdb  /dec/sda1  /dev/sda2
/dev/sr0         ##光驱
/dev/mapper/*    ##虚拟设备
/sda             ##系统第一块串口硬盘,a代表第一块
/cdrom,/dev/sr0 ##代表光驱
/hd0             ##系统闭口硬盘

2.设备的挂载

mount  设备  挂载点            #挂载
umount /mnt                   #卸载挂载到/mnt下,可能会挂载到别的目录下
umount /dev/sdb1              #卸载u盘挂载
注意:在/mnt/目录下卸载不了

mount  -o ro /dev/sdb1   /mnt/                #只读挂载
mount  -o  remount,rw  /dev/sdb1 | /mnt/      #重新读写挂载
mount    #查看挂载信息


注意:两个设备挂载到同一个目录上,第二个会将第一个覆盖,一般情况下不能挂载在同一个目录下

3.解决设备正忙的情况
解决方法1:

fuser -kvm /mnt
umount /mnt


解决方法2:

lsof /mnt/
kill -9  进程号
umount /mnt


 

磁盘分区

1.硬盘0磁道1扇区的512个字节中记录的信息如下:

512 = 446   +64   +2  字节
      mbr   mot   55aa

mbr      主引导记录
mpt      主分区标
55aa     硬盘有效标识

注意:
mpt   硬盘分区标   64字节
一块硬盘上最多可以划分4个主分区,每个分五占16个字节,记录分区
硬盘的分区:主分区、扩展分区、逻辑分区 

主分区;用主分区表记录的分区
扩展分区:主分区表记录的容器,不能直接使用
逻辑分区:容器中的分区

分区表记录容器信息,容器自己记录容器分区
 
 
2.分区步骤
第一步:fdisk -l

[root@localhost Desktop]# fdisk -l

Disk /dev/vda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013f3e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    20970332    10484142+  83  Linux

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


第二步:fdisk /dev/ 进入分区界面

command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition                             ##删除
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types                     ##查询分区id
   m   print this menu                                ##查询帮助
   n   add a new partition                            ##新建
   o   create a new empty DOS partition table
   p   print the partition table                      ##显示分区
   q   quit without saving changes                    ##退出
   s   create a new empty Sun disklabel
   t   change a partition's system id                 ##修改分区id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit                    ##保存分区标信息到硬盘
   x   extra functionality (experts only)



第三步:建立主分区

[root@localhost Desktop]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x312c67f3.

Command (m for help): n                                          ##新建分区
Partition type:
   p   primary (0 primary, 0 extended, 4 free)                   ##主分区
   e   extended                                                  ##扩展分区
Select (default p):  
Using default response p                                         ##选择默认
Partition number (1-4, default 1): 
First sector (2048-20971519, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +100M  ##100M
Partition 1 of type Linux and of size 100 MiB is set

Command (m for help): p                                         ##查看分区

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux

Command (m for help): wq                                         ##保存并退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


第四步:格式化分区  mkfs.xfs /dev/vdb1

[root@localhost Desktop]# mkfs.xfs /dev/vdb1
meta-data=/dev/vdb1              isize=256    agcount=4, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=25600, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

查看可用设备,此时/dev/vdb1为可用设备

[root@localhost Desktop]# blkid
/dev/vda1: UUID="9bf6b9f7-92ad-441b-848e-0257cbb883d1" TYPE="xfs" 
/dev/vdb1: UUID="0168a321-bdd9-4ef5-b476-83de5ecd8b63" TYPE="xfs" 


第五步:挂载,设备挂载之后才能使用
 

[root@localhost Desktop]# mount /dev/vdb1 /mnt/
[root@localhost Desktop]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/vda1       10473900 3165192   7308708  31% /
devtmpfs          469344       0    469344   0% /dev
tmpfs             484932     140    484792   1% /dev/shm
tmpfs             484932   12736    472196   3% /run
tmpfs             484932       0    484932   0% /sys/fs/cgroup
/dev/vdb1          98988    5280     93708   6% /mnt
[root@localhost Desktop]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n                                                ####继续添加分区
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 
First sector (206848-20971519, default 206848): 
Using default value 206848
Last sector, +sectors or +size{K,M,G} (206848-20971519, default 20971519): +100M
Partition 2 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux


Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3): 
First sector (411648-20971519, default 411648): 
Using default value 411648
Last sector, +sectors or +size{K,M,G} (411648-20971519, default 20971519): +100M
Partition 3 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux

Command (m for help): n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e):                             ####当添加到第四个分区,默认分区为扩展分区e
Using default response e
Selected partition 4
First sector (616448-20971519, default 616448): 
Using default value 616448
Last sector, +sectors or +size{K,M,G} (616448-20971519, default 20971519): 
Using default value 20971519
Partition 4 of type Extended and of size 9.7 GiB is set

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux
/dev/vdb4          616448    20971519    10177536    5  Extended

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.

    
 注意:
1.若添加完成一个分区之后继续添加,会出现warning ,此时可以手动同步分区partprobe 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

手动同步分区标

[root@localhost Desktop]# partprobe
[root@localhost Desktop]# cat /proc/partitions 
major minor  #blocks  name

 253        0   10485760 vda
 253        1   10484142 vda1
 253       16   10485760 vdb
 253       17     102400 vdb1
 253       18     102400 vdb2
 253       19     102400 vdb3
 253       20          1 vdb4


2.当系统已经有三个主分区时,添加扩展分区
    添加扩展分区后,不能对扩展分区进行格式化,要对扩展分区中的逻辑分区进行格式化
 

[root@localhost Desktop]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (618496-20971519, default 618496): 
Using default value 618496
Last sector, +sectors or +size{K,M,G} (618496-20971519, default 20971519): +100M
Partition 5 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux
/dev/vdb4          616448    20971519    10177536    5  Extended        ##把剩下的空间全给扩展分区
/dev/vdb5          618496      823295      102400   83  Linux

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost Desktop]# partprobe
[root@localhost Desktop]# cat /proc/partitions 
major minor  #blocks  name

 253        0   10485760 vda
 253        1   10484142 vda1
 253       16   10485760 vdb
 253       17     102400 vdb1
 253       18     102400 vdb2
 253       19     102400 vdb3
 253       20          1 vdb4
 253       21     102400 vdb5

[root@localhost Desktop]# mkfs.xfs /dev/vdb5
meta-data=/dev/vdb5              isize=256    agcount=4, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=25600, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost Desktop]# mount /dev/vdb5 /test/
[root@localhost Desktop]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/vda1       10473900 3165944   7307956  31% /
devtmpfs          469344       0    469344   0% /dev
tmpfs             484932     472    484460   1% /dev/shm
tmpfs             484932   12792    472140   3% /run
tmpfs             484932       0    484932   0% /sys/fs/cgroup
/dev/vdb1          98988    5280     93708   6% /mnt
/dev/vdb5          98988    5280     93708   6% /test


永久挂载:
vim /etc/fatab      开机自动挂载策略文件
/dev/vdb5   /mnt  xfs  defaults              0    0  
 分区        挂载点 格式     挂载参数        是否备份 是否检测
 
 


文件系统比较


ext3 是rhel5及之前的版本,最多支持32TB的文件系统和2T文件,实际2TB文件系统,16G文件


ext4 是 Red Hat Enterprise Linux 6 的标准文件系统。它非常强靠 ,具有多项可以提高现代工作量处理性能的功能,最多支持1EB的文件系统和16T文件


ext2 是常用于 Linux 中的较旧的文件系统。它简单可靠 , 非常适合小型存储设备 , 但是效率低于 ext4


vfat 支持包括一系列相关文件系统 ( VFAT/FAT16 ,FAT32 ), 这些文件系统针对较旧版本的 Microsoft Windows 开发 , 在大量的系统和设备上受支持


xfs 在 Red Hat Enterprise Linux 7 的标准文件系统其具备数据完全、性能稳定、扩展性强 ( 8eb-1byte ) 、传输速率高 ( 7G/s ),最多支持18EB的文件系统和9E文件  7G/s   4G/s
 
 


swap分区管理


换空间或交换区是磁盘驱动器上的空间 , 用作当前未使用部分内存的溢出。这样 , 系统就能在主内存中留出空间用于储存当前正在处理的数据 , 并在系统面临主内存空间不足的风险时提供应急溢出


swap分区新建

第一步:使用 fdisk 创建新分区。此外 , 在用 fdisk 保存更改之前 ,  将分区类型更改为 “ 0x82 Linux Swap”

[root@localhost Desktop]# swapon -s
[root@localhost Desktop]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux
/dev/vdb4          616448    20971519    10177536    5  Extended
/dev/vdb5          618496      823295      102400   83  Linux

Command (m for help): n
All primary partitions are in use
Adding logical partition 6
First sector (825344-20971519, default 825344): 
Using default value 825344
Last sector, +sectors or +size{K,M,G} (825344-20971519, default 20971519): +100M
Partition 6 of type Linux and of size 100 MiB is set

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux
/dev/vdb4          616448    20971519    10177536    5  Extended
/dev/vdb5          618496      823295      102400   83  Linux
/dev/vdb6          825344     1030143      102400   83  Linux

Command (m for help): t                                       ####更改类型
Partition number (1-6, default 6): 6
Hex code (type L to list all codes): l

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT            
1e  Hidden W95 FAT1 80  Old Minix      
Hex code (type L to list all codes): 82                             ##改换分区
Changed type of partition 'Linux' to 'Linux swap / Solaris'

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux
/dev/vdb4          616448    20971519    10177536    5  Extended
/dev/vdb5          618496      823295      102400   83  Linux
/dev/vdb6          825344     1030143      102400   82  Linux swap / Solaris

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

第二步:准备好将分区用作交换区

[root@localhost Desktop]# mkswap /dev/vdb6
Setting up swapspace version 1, size = 102396 KiB
no label, UUID=bffb98b1-3b73-41e8-b132-18df4d95cd22


第三步:将新交换空间添加到 /etc/fstab

 
第四步:swapon -a 将激活新交换区

[root@localhost Desktop]# swapon -a /dev/vdb6

swapon -s 将显示当前交换区的状态

 [root@localhost Desktop]# swapon -s
Filename                Type        Size    Used    Priority
/dev/vdb6                                  partition    102396    0    -1

swap分区删除


第一步:编辑 /etc/fstab文件,将文件内容删除
第二步:swapoff /dev/vdaN 将停用该特定交换区

[root@localhost Desktop]# swapoff /dev/vdb6

 第三步:fdisk  /dev/vdb,进入编辑界面,删除设备

[root@localhost Desktop]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d                                  ##删除设备
Partition number (1-6, default 6): 6
Partition 6 is deleted

Command (m for help): p

Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x312c67f3

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048      206847      102400   83  Linux
/dev/vdb2          206848      411647      102400   83  Linux
/dev/vdb3          411648      616447      102400   83  Linux
/dev/vdb4          616448    20971519    10177536    5  Extended
/dev/vdb5          618496      823295      102400   83  Linux

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

注意:删除设备之前程序要先停止,否则会出现错误,出现错误时,解挂载后,同步分区

第四步:同步分区标

partprobe

配额

1.什么是quota

  简单的说就是限制用户对磁盘空间的使用量。

  因为Linux是多用户多任务的操作系统,许多人共用磁盘空间,为了合理的分配磁盘空间,于是就有了quota的出现。

2.quota的用途
    显示磁盘使用情况和配额

3.quota的一般作用对象
    (1)针对WWW server
    (2)针对mail server
    (3)针对file server
 

4.quota的限制
    (1)仅能针对整个文件系统
    (2)需要kernel的支持
    (3)只对一般用户有效

5.如何设定配额的限额???

第一步:开启quota功能

mount -o usrquota /dev/vdb5  /westos 
chmod  777 /westos

第二步:设定student用户对磁盘/dev/vdb5的配额,使用edquota -u student命令编辑文件

filesystem blocks    soft  hard   inodes   soft   hard
  1         2         3     4      5        6      7
1:文件系统,说明该限制值时针对哪个文件系统
2:磁盘容量,这个值时quota自己算出来的,不要更改
3:磁盘容量的soft限制值
4:磁盘容量的hard限制值
5:文件数量,quota自己算出来的,不要改动
6:inode的soft值
7:inode的hard值

soft/hard为0时,表示没有限制,我们需要的是设置blocks的soft/hard值,inode的不要更改

如何让配额自动挂载,需要编辑/etc/fstab文件??
vim /etc/fstab
/dev/vdb5  /pub  xfs   defauits,usrquota  0  0
 
 
测试:切换到student用户进行测试

 
 

 
 
 
 
 
 
 

猜你喜欢

转载自blog.csdn.net/sinceNow/article/details/83783221