find 参数 | |
---|---|
-name | 名字 |
-user | 用户 |
-group | 组 |
-type | 类型 f:文件 l:符号连接 d:目录 c:字符设备 b:块设备 s:套接字 |
exec | 执行 |
-maxdepth | 最大深度 |
-mindepth | 最小深度 |
-cmin | 最近更改的文件 1 :1分钟, +1:大于1分钟, -1:1分钟之内 |
-o | 或者 |
-a | 而且 |
not | 相反 |
size | 大小 |
实验环境:
[root@node1 mnt]# useradd lee [root@node1 mnt]# chown westos.lee westosfile1 [root@node1 mnt]# chown westos.westos westosfile2 [root@node1 mnt]# chown lee.lee westosfile3 [root@node1 mnt]# ll total 0 -rw-r--r--. 1 westos lee 0 Oct 18 14:39 westosfile1 -rw-r--r--. 1 westos westos 0 Oct 18 14:39 westosfile2 -rw-r--r--. 1 lee lee 0 Oct 18 14:39 westosfile3 -rw-r--r--. 1 root root 0 Oct 18 14:39 westosfile4 -rw-r--r--. 1 root root 0 Oct 18 14:39 westosfile5
实验:
[root@node1 mnt]# find /mnt/ -name "*westos*" 查找文件 /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 /mnt/westosfile4 /mnt/westosfile5 [root@node1 mnt]# mkdir westosdir [root@node1 mnt]# touch westosdir/westosfile1 [root@node1 mnt]# find /mnt/ -name westosfile1 查找目录里面的,和子目录里面的文件都能查找到 /mnt/westosfile1 /mnt/westosdir/westosfile1 [root@node1 mnt]# find /mnt/ -maxdepth 1 -name westosfile1 最大深度为1层 /mnt/westosfile1 [root@node1 mnt]# find /mnt/ -maxdepth 2 -name westosfile1 最大深度为2层 /mnt/westosfile1 /mnt/westosdir/westosfile1 [root@node1 mnt]# find /mnt/ -mindepth 2 -maxdepth 2 -name westosfile1 指定第2层 /mnt/westosdir/westosfile1 [root@node1 mnt]# find /mnt/ -type f 查看文件 /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir/westosfile1 [root@node1 mnt]# find /mnt/ -type d 查看目录 /mnt/ /mnt/westosdir [root@node1 mnt]# find /mnt/ -user lee 查看用户 /mnt/westosfile3 [root@node1 mnt]# find /mnt/ -user lee -o -user westos -o表示或者 ,查询多个用户文件 /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 [root@node1 mnt]# find /mnt/ -user lee -a -user lee -a 表示并且 ,-a也可以不加 /mnt/westosfile3 [root@node1 mnt]# find /mnt/ -user westos -group westos 用户和组都是westos /mnt/westosfile2 [root@node1 mnt]# find /mnt/ -user westos -not -group westos 用户是westos,组不是westos /mnt/westosfile1
用文件大小查找文件
制作指定文件大小 [root@node1 mnt]# dd if=/dev/zero of=/mnt/westosfile1 bs=1M count=10 bs 表示拷贝块的大小 ,count表示有多少块,dd:用指定大小的块拷贝一个文件 if=模板文件 10+0 records in 10+0 records out 10485760 bytes (10 MB, 10 MiB) copied, 0.0484184 s, 217 MB/s [root@node1 mnt]# dd if=/dev/zero of=/mnt/westosfile2 bs=1M count=20 20+0 records in 20+0 records out 20971520 bytes (21 MB, 20 MiB) copied, 0.0120816 s, 1.7 GB/s [root@node1 mnt]# dd if=/dev/zero of=/mnt/westosfile3 bs=1M count=30 30+0 records in 30+0 records out 31457280 bytes (31 MB, 30 MiB) copied, 0.0175175 s, 1.8 GB/s [root@node1 mnt]# du -sh westosfile1 10M westosfile1 [root@node1 mnt]# du -sh westosfile2 20M westosfile2 [root@node1 mnt]# du -sh westosfile3 30M westosfile3 [root@node1 mnt]# find /mnt/ -size 20M 等于20M /mnt/westosfile2 [root@node1 mnt]# find /mnt/ -size -20M 小于20M /mnt/ /mnt/westosfile1 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir /mnt/westosdir/westosfile1 [root@node1 mnt]# find /mnt/ -size +20M 大与20M /mnt/westosfile3
时间查找文件
[root@node1 mnt]# touch westosfile6 [root@node1 mnt]# find /mnt/ -cmin 1 分钟 /mnt/ /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -cmin -1 1分钟以内的 /mnt/ /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -cmin +1 大于1分钟的 /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir /mnt/westosdir/westosfile1
权限查找文件
[root@node1 mnt]# chmod g-r /mnt/westosfile2 [root@node1 mnt]# chmod o-r /mnt/westosfile3 [root@node1 mnt]# ll total 61440 drwxr-xr-x. 2 root root 25 Oct 18 15:12 westosdir -rw-r--r--. 1 westos lee 10485760 Oct 18 16:41 westosfile1 -rw----r--. 1 westos westos 20971520 Oct 18 16:41 westosfile2 -rw-r-----. 1 lee lee 31457280 Oct 18 16:41 westosfile3 -rw-r--r--. 1 root root 0 Oct 18 14:39 westosfile4 -rw-r--r--. 1 root root 0 Oct 18 14:39 westosfile5 -r-r--r--. 1 root root 0 Oct 18 17:12 westosfile6 [root@node1 mnt]# find /mnt/ -perm 444 表示u位,g位,o位都必须只是r权限 /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -perm -444 -444表示u 位,g位,o位都开启r权限 /mnt/ /mnt/westosfile1 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir /mnt/westosdir/westosfile1 /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -perm /444 /444表示u位或者g位或者o位开启了r权限 /mnt/ /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir /mnt/westosdir/westosfile1 /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -perm /755 总共7个条件 rwxr-xr-x 或的关系 /mnt/ /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir /mnt/westosdir/westosfile1 /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -perm /777 总管9个条件 /mnt/ /mnt/westosfile1 /mnt/westosfile2 /mnt/westosfile3 /mnt/westosfile4 /mnt/westosfile5 /mnt/westosdir /mnt/westosdir/westosfile1 /mnt/westosfile6 [root@node1 mnt]# find /mnt/ -perm -002 表示o位有写的权限 [root@node1 mnt]# chmod 777 westosfile5 [root@node1 mnt]# ll -rwxrwxrwx. 1 root root 0 Oct 18 14:39 westosfile5 [root@node1 mnt]# find /mnt/ -perm -002 -exec chmod u-w {} \; \表示转译符 注释分号的作用 ,-exec表示可以执行的动作 [root@node1 mnt]# find /mnt/ -name \*westos\* -exec rm -fr {} \; 删除带有westos的文件; {}表示find命令查找的结果 find: ‘/mnt/westosdir’: No such file or directory
设备接入系统后都是以文件的形式存在
设备名称 | ####### |
---|---|
SATA/SAS/USB | /dev/sda,/dev/sdb s=STAT ,d=DISK ,a=第几块 |
IDE | /dev/hd0,/dev/hsd1 ##h=hard |
VIRTIO-BLOCK | /dev/vda, /dev/vdb #v=virtio |
M2 (SSD) | /dev/nvme0,.dev/nvme1 #nvme=m2 |
SD/MMC/EMMC(卡) | /dev/mmcblk0,/dev/mmcblk1 # mmcblk=mmc卡 |
光驱 | /dev/cdrom,/dev/sr0,/dev/sr1 |
fdisk -l :查看磁盘分区情况 (真实存在的设备)
lsblk:设备使用情况
blkid:设备管理方式及设备id
df:查看正在被系统挂载的设备
cat /proc/partitions:查看系统识别设备 (系统识别的设备与系统识别的设备存在差异,没有uuid。无驱动,需要被提醒,)
[root@node1 mnt]# fdisk -l 查看磁盘分区情况 Disk /dev/vda: 8 GiB, 8589934592 bytes, 16777216 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 Disklabel type: dos Disk identifier: 0x657e7edc Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 1026047 1024000 500M 83 Linux /dev/vda2 1026048 2050047 1024000 500M 82 Linux swap / Solaris /dev/vda3 2050048 16777215 14727168 7G 83 Linux Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 [root@node1 mnt]# lsblk 查看系统中识别设备 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 8G 0 disk ├─vda1 253:1 0 500M 0 part /boot ├─vda2 253:2 0 500M 0 part [SWAP] └─vda3 253:3 0 7G 0 part / vdb 253:16 0 5G 0 disk [root@node1 mnt]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 8G 0 disk ├─vda1 253:1 0 500M 0 part /boot ├─vda2 253:2 0 500M 0 part [SWAP] └─vda3 253:3 0 7G 0 part / vdb 253:16 0 5G 0 disk [root@node1 mnt]# cat /proc/partitions 查看系统中识别设备 major minor #blocks name 253 0 8388608 vda 253 1 512000 vda1 253 2 512000 vda2 253 3 7363584 vda3 253 16 5242880 vdb [root@node1 mnt]# df 系统中被使用挂载的设备 Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 907424 0 907424 0% /dev tmpfs 935220 0 935220 0% /dev/shm tmpfs 935220 9336 925884 1% /run tmpfs 935220 0 935220 0% /sys/fs/cgroup /dev/vda3 7353344 4372764 2980580 60% / /dev/vda1 506528 218600 287928 44% /boot tmpfs 187044 1180 185864 1% /run/user/42 tmpfs 187044 4 187040 1% /run/user/0 [root@node1 mnt]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 887M 0 887M 0% /dev tmpfs 914M 0 914M 0% /dev/shm tmpfs 914M 9.2M 905M 1% /run tmpfs 914M 0 914M 0% /sys/fs/cgroup /dev/vda3 7.1G 4.2G 2.9G 60% / /dev/vda1 495M 214M 282M 44% /boot tmpfs 183M 1.2M 182M 1% /run/user/42 tmpfs 183M 4.0K 183M 1% /run/user/0 [root@node1 mnt]# blkid 设备id /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03"
mount 挂载参数 device 挂载点
umount 设备|挂载点
mount:查看挂载信息
mount -o rw /dev/nvme0n1p1 /westos
mount -o remount,ro /westos:转换挂载参数
插上u盘 [root@foundation50 ~]# df 查看系统挂载的设备 Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 6054996 0 6054996 0% /dev tmpfs 6085392 113668 5971724 2% /dev/shm tmpfs 6085392 18332 6067060 1% /run tmpfs 6085392 0 6085392 0% /sys/fs/cgroup /dev/mapper/rhel_foundation50-root 307230136 95267084 211963052 32% / /dev/sda6 1038336 213064 825272 21% /boot /dev/sda2 98304 31279 67025 32% /boot/efi /dev/loop0 8238560 8238560 0 100% /var/www/html/westos tmpfs 1217076 12 1217064 1% /run/user/42 tmpfs 1217076 40 1217036 1% /run/user/1000 /dev/sdb1 30217792 26936948 3280844 90% /run/media/westos/BAEC11CAEC118235 u盘已经挂载 [root@foundation50 ~]# cd /run/media/westos/BAEC11CAEC118235 [root@foundation50 BAEC11CAEC118235]# ls '~$核实经办10.08(2).xlsx' 01_Python基础.zip 02_Python进阶.zip 10.8医保失败.xls 10.8社保失败.xls '2021.09.06医保回盘数据(1).xls' 2021.09.16-2021.09.26西咸失败数据.xlsx [root@foundation50 ~]# umount /dev/sdb1 卸载 也可以 umount /mnt [root@foundation50 ~]# mount /dev/sdb1 /mnt/ 将u盘挂载到指定目录/mnt上 [root@foundation50 ~]# cd /mnt/ [root@foundation50 mnt]# ls '~$核实经办10.08(2).xlsx' 01_Python基础.zip 02_Python进阶.zip 10.8医保失败.xls 10.8社保失败.xls '2021.09.06医保回盘数据(1).xls' 2021.09.16-2021.09.26西咸失败数据.xlsx 2021.09.29票据重复异常.rar 20211009反馈数据 2021年重点工作督查内容介绍.doc 20221.09.27-2021.10.08西咸票据重复明细.rar [root@foundation50 mnt]# mount 查看挂载信息 /dev/sdb1 on /mnt type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096) [root@foundation50 mnt]# touch file 挂载后可以读写 [root@foundation50 ~]# umount /mnt 卸载 [root@foundation50 ~]# mount -o ro /dev/sdb1 /mnt/ 变成只读 [root@foundation50 mnt]# mount /dev/sdb1 on /mnt type fuseblk (ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096) 变成ro只读 [root@foundation50 mnt]# touch file 不能建立文件 touch: cannot touch 'file': Read-only file system [root@foundation50 mnt]# mount -o remount,rw /dev/sdb1 重新挂载变成读写 /dev/sdb1 on /mnt type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096) [root@foundation50 mnt]# umount /mnt 卸载 umount: /mnt: target is busy. [root@foundation50 mnt]# lsof /dev/sdb1 查看正在用设备 lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs Output information may be incomplete. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME bash 3906 root cwd DIR 8,17 12288 5 /mnt bash 8380 westos cwd DIR 8,17 12288 5 /mnt lsof 10612 root cwd DIR 8,17 12288 5 /mnt lsof 10613 root cwd DIR 8,17 12288 5 /mnt [root@foundation50 mnt]# fuser -kvm /dev/sdb1 结束正在占用的设备 USER PID ACCESS COMMAND /dev/sdb1: root kernel mount /mnt root 3906 ..c.. bash root 7961 f.... mount.ntfs westos 8380 ..c.. bash Killed
MBR分区方式
主分区:主分区记录分区信息并可以直接使用的分区
扩展分区
主分区表记录的的分区,不可直接使用,是逻辑分区容器
逻辑分区
扩展分区之上划分的分区叫逻辑分区,不占用分区表,如果扩展分区损坏,逻辑分区全部坏掉
分区命令的使用
parted
[root@node1 ~]# parted /dev/vdb mklabel gpt 设置分区类型,gpt分区类型 Information: You may need to update /etc/fstab. [root@node1 ~]# fdisk -l Disk /dev/vda: 8 GiB, 8589934592 bytes, 16777216 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 Disklabel type: dos Disk identifier: 0x657e7edc Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 1026047 1024000 500M 83 Linux /dev/vda2 1026048 2050047 1024000 500M 82 Linux swap / Solaris /dev/vda3 2050048 16777215 14727168 7G 83 Linux Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: gpt gpt分区类型 Disk identifier: F5409EDE-875E-42AA-BFF7-640C258532DA [root@node1 ~]# parted /dev/vdb mklabel msdos 设置分区类型,mrb分区类型 [root@node1 ~]# fdisk -l Disk /dev/vda: 8 GiB, 8589934592 bytes, 16777216 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 Disklabel type: dos Disk identifier: 0x657e7edc Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 1026047 1024000 500M 83 Linux /dev/vda2 1026048 2050047 1024000 500M 82 Linux swap / Solaris /dev/vda3 2050048 16777215 14727168 7G 83 Linux Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos dos分区方式 Disk identifier: 0x6f1c4a71 [root@node1 ~]# parted /dev/vdb mkpart primary 1 1000 划一个主分区 Information: You may need to update /etc/fstab. [root@node1 ~]# fdisk -l Disk /dev/vda: 8 GiB, 8589934592 bytes, 16777216 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 Disklabel type: dos Disk identifier: 0x657e7edc Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 1026047 1024000 500M 83 Linux /dev/vda2 1026048 2050047 1024000 500M 82 Linux swap / Solaris /dev/vda3 2050048 16777215 14727168 7G 83 Linux Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0x6f1c4a71 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 1953791 1951744 953M 83 Linux [root@node1 ~]# parted /dev/vdb rm 1 删除分区,后面数字表示第几个分区 Information: You may need to update /etc/fstab.
fdisk 交互式分区
fdisk /dev/XXX
Command (m for help): m
命令 | 作用 |
---|---|
d | 删除 |
l | 列出所有分区类型 |
n | 新建 |
p | 显示分区表 |
t | 更改分区类型 |
w | 保存更改 |
q | 退出 |
g | 设定分区方式为GPT |
o | 设定分区方式为mbr |
[root@node1 ~]# fdisk /dev/vdb 分区 Welcome to fdisk (util-linux 2.32.1). 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: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0x6f1c4a71 Command (m for help): g 设定分区方式为GPT Created a new GPT disklabel (GUID: 4CBFD80F-A7B3-E84D-AA13-14809214E95B). The old dos signature will be removed by a write command. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: gpt gpt分区方式 Disk identifier: 4CBFD80F-A7B3-E84D-AA13-14809214E95B Command (m for help): o mbr分区方式 Created a new DOS disklabel with disk identifier 0xb925413a. The old dos signature will be removed by a write command. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos mbr分区方式 Disk identifier: 0xb925413a Command (m for help): n 新建分区 Partition type p primary (0 primary, 0 extended, 4 free) p表示主分区 e extended (container for logical partitions) e表示扩展分区 Select (default p): p 主分区 Partition number (1-4, default 1): 1 分区位置 First sector (2048-10485759, default 2048): 分区起始快 Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): +100M 结束快 Created a new partition 1 of type 'Linux' and of size 100 MiB. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xb925413a Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 206847 204800 100M 83 Linux 已经划分出来了 Command (m for help): n 增加第二个分区 Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): p Partition number (2-4, default 2): First sector (206848-10485759, default 206848): Last sector, +sectors or +size{K,M,G,T,P} (206848-10485759, default 10485759): +100M Created a new partition 2 of type 'Linux' and of size 100 MiB. Command (m for help): n 增加第三个分区 Partition type p primary (2 primary, 0 extended, 2 free) e extended (container for logical partitions) Select (default p): p Partition number (3,4, default 3): First sector (411648-10485759, default 411648): Last sector, +sectors or +size{K,M,G,T,P} (411648-10485759, default 10485759): +100M Created a new partition 3 of type 'Linux' and of size 100 MiB. Command (m for help): P P: unknown command Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xb925413a Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 206847 204800 100M 83 Linux /dev/vdb2 206848 411647 204800 100M 83 Linux /dev/vdb3 411648 616447 204800 100M 83 Linux Command (m for help): n Partition type p primary (3 primary, 0 extended, 1 free) e extended (container for logical partitions) Select (default e): e Selected partition 4 First sector (616448-10485759, default 616448): Last sector, +sectors or +size{K,M,G,T,P} (616448-10485759, default 10485759): Created a new partition 4 of type 'Extended' and of size 4.7 GiB. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xb925413a Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 206847 204800 100M 83 Linux /dev/vdb2 206848 411647 204800 100M 83 Linux /dev/vdb3 411648 616447 204800 100M 83 Linux /dev/vdb4 616448 10485759 9869312 4.7G 5 Extended Command (m for help): n 增加逻辑分区 All primary partitions are in use. Adding logical partition 5 First sector (618496-10485759, default 618496): Last sector, +sectors or +size{K,M,G,T,P} (618496-10485759, default 10485759): +100M Created a new partition 5 of type 'Linux' and of size 100 MiB. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xb925413a Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 206847 204800 100M 83 Linux /dev/vdb2 206848 411647 204800 100M 83 Linux /dev/vdb3 411648 616447 204800 100M 83 Linux /dev/vdb4 616448 10485759 9869312 4.7G 5 Extended /dev/vdb5 618496 823295 204800 100M 83 Linux Command (m for help): wq 保存更改 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. [root@node1 ~]# udevadm settle 设备上的分区表和内核上的分区表同步 [root@node1 ~]# blkid 查看设备id,这些设备不能使用只是划分了分区,设备上没有文件系统 /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03" /dev/vdb1: PARTUUID="b925413a-01" /dev/vdb2: PARTUUID="b925413a-02" /dev/vdb3: PARTUUID="b925413a-03" /dev/vdb5: PARTUUID="b925413a-05"
[root@node1 ~]# mkfs.xfs /dev/vdb1 格式化成xfs系统 meta-data=/dev/vdb1 isize=512 agcount=4, agsize=6400 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=25600, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@node1 ~]# blkid /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03" /dev/vdb1: UUID="d8358f7d-3908-4372-9ee3-d93621aedd9c" TYPE="xfs" PARTUUID="b925413a-01" /dev/vdb2: PARTUUID="b925413a-02" /dev/vdb3: PARTUUID="b925413a-03" /dev/vdb5: PARTUUID="b925413a-05" [root@node1 ~]# mkfs.vfat /dev/vdb2 格式化成fat系统 mkfs.fat 4.1 (2017-01-24) [root@node1 ~]# blkid /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03" /dev/vdb1: UUID="d8358f7d-3908-4372-9ee3-d93621aedd9c" TYPE="xfs" PARTUUID="b925413a-01" /dev/vdb2: SEC_TYPE="msdos" UUID="E913-E741" TYPE="vfat" PARTUUID="b925413a-02" /dev/vdb3: PARTUUID="b925413a-03" /dev/vdb5: PARTUUID="b925413a-05" [root@node1 ~]# mkfs.ext4 /dev/vdb3 格式化成ext文件系统 mke2fs 1.45.4 (23-Sep-2019) Creating filesystem with 102400 1k blocks and 25688 inodes Filesystem UUID: 378f3fd1-576e-4f9a-9b65-11d0f89adccc Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done [root@node1 ~]# bklid bash: bklid: command not found... Similar command is: 'blkid' [root@node1 ~]# blkid /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03" /dev/vdb1: UUID="d8358f7d-3908-4372-9ee3-d93621aedd9c" TYPE="xfs" PARTUUID="b925413a-01" /dev/vdb2: SEC_TYPE="msdos" UUID="E913-E741" TYPE="vfat" PARTUUID="b925413a-02" /dev/vdb3: UUID="378f3fd1-576e-4f9a-9b65-11d0f89adccc" TYPE="ext4" PARTUUID="b925413a-03" /dev/vdb5: PARTUUID="b925413a-05" [root@node1 ~]# mkfs.xfs -K /dev/vdb5 通常格式化新的磁盘比较大的情况下 ,-K表示不对空的数据快进行处理,加快格式化 meta-data=/dev/vdb5 isize=512 agcount=4, agsize=6400 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=25600, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@node1 ~]# blkid /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03" /dev/vdb1: UUID="d8358f7d-3908-4372-9ee3-d93621aedd9c" TYPE="xfs" PARTUUID="b925413a-01" /dev/vdb2: SEC_TYPE="msdos" UUID="E913-E741" TYPE="vfat" PARTUUID="b925413a-02" /dev/vdb3: UUID="378f3fd1-576e-4f9a-9b65-11d0f89adccc" TYPE="ext4" PARTUUID="b925413a-03" /dev/vdb5: UUID="33cbf078-e066-490c-8170-11c8d2d4c2c3" TYPE="xfs" PARTUUID="b925413a-05"
格式化之后就可以挂载
[root@node1 ~]# mount /dev/vdb5 /mnt/ (临时挂载) [root@node1 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 907604 0 907604 0% /dev tmpfs 935400 0 935400 0% /dev/shm tmpfs 935400 9364 926036 2% /run tmpfs 935400 0 935400 0% /sys/fs/cgroup /dev/vda3 7353344 4373064 2980280 60% / /dev/vda1 506528 218600 287928 44% /boot tmpfs 187080 1180 185900 1% /run/user/42 tmpfs 187080 4 187076 1% /run/user/0 /dev/vdb5 96928 6068 90860 7% /mnt 如何实现永久挂载 [root@node1 ~]# vim /etc/rc.d/rc.local 之前学的这个挂载是系统启动之后最后一步实行挂载 [root@node1 ~]# vim /etc/fstab 需要在磁盘挂载策略文件里永久挂载 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # UUID=0eb49537-4c55-4a43-986f-98bd31d7cfd2 / xfs defaults 0 0 UUID=3cc65186-5c1a-4b64-937d-76fa3feec0c8 /boot xfs defaults 0 0 UUID=a0f0361a-8846-4d19-ac39-653b0b79aff8 swap swap defaults 0 0 /dev/vdb5 /mnt xfs defaults 0 0 设备名 挂载点 系统文件类型 挂载参数 不检测 不备份 [root@node1 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 907604 0 907604 0% /dev tmpfs 935400 0 935400 0% /dev/shm tmpfs 935400 9364 926036 2% /run tmpfs 935400 0 935400 0% /sys/fs/cgroup /dev/vda3 7353344 4373064 2980280 60% / /dev/vda1 506528 218600 287928 44% /boot tmpfs 187080 1180 185900 1% /run/user/42 tmpfs 187080 4 187076 1% /run/user/0 [root@node1 ~]# mount -a 表示将/etc/fstab 里没有挂载的设备立即挂载 [root@node1 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 907604 0 907604 0% /dev tmpfs 935400 0 935400 0% /dev/shm tmpfs 935400 9364 926036 2% /run tmpfs 935400 0 935400 0% /sys/fs/cgroup /dev/vda3 7353344 4373064 2980280 60% / /dev/vda1 506528 218600 287928 44% /boot tmpfs 187080 1180 185900 1% /run/user/42 tmpfs 187080 4 187076 1% /run/user/0 /dev/vdb5 96928 6068 90860 7% /mnt 已经挂载 如何删除设备 将/etc/fstab 里的挂载删除 [root@node1 ~]# umount /mnt 卸载 [root@node1 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 907604 0 907604 0% /dev tmpfs 935400 0 935400 0% /dev/shm tmpfs 935400 9364 926036 2% /run tmpfs 935400 0 935400 0% /sys/fs/cgroup /dev/vda3 7353344 4373088 2980256 60% / /dev/vda1 506528 218600 287928 44% /boot tmpfs 187080 1180 185900 1% /run/user/42 tmpfs 187080 4 187076 1% /run/user/0 [root@node1 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.32.1). 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-5, default 5): 5 删除第5个设备 Partition 5 has been deleted. Command (m for help): d Partition number (1-4, default 4): 4 删除 第四个设备 Partition 4 has been deleted. Command (m for help): d Partition number (1-3, default 3): 3 删除第三个设备 Partition 3 has been deleted. Command (m for help): d Partition number (1,2, default 2): 2 删除第二个设备 Partition 2 has been deleted. Command (m for help): d Selected partition 1 删除第一个设备 Partition 1 has been deleted. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xb925413a Command (m for help): wq 保存 [root@node1 ~]# dd if=/dev/zero of=/dev/vdb bs=1M count=1 快速清掉设备分区表,原理是用一个空的1M去覆盖设备最前面的1M 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00432005 s, 243 MB/s
swap分区作用
建议内存
[root@node1 ~]# swapon -s 查看系统中的swap分区 Filename Type Size Used Priority /dev/vda2 partition 511996 0 -2 [root@node1 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.32.1). 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. Created a new DOS disklabel with disk identifier 0xa14f4727. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-10485759, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): +1G Created a new partition 1 of type 'Linux' and of size 1 GiB. Partition #1 contains a xfs signature. Do you want to remove the signature? [Y]es/[N]o: y The signature will be removed by a write command. Command (m for help): t 修改标签 Selected partition 1 Hex code (type L to list all codes): l 列出所有code代码 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 or 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 ea Rufus alignment e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT 10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/ 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b 12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto 1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep 1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT Hex code (type L to list all codes): 82 改称swap Changed type of partition 'Linux' to 'Linux swap / Solaris'. Command (m for help): p 查看分区表信息 Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xa14f4727 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 2099199 2097152 1G 82 Linux swap / Solaris swap已经更改成功 Filesystem/RAID signature on partition 1 will be wiped. Command (m for help): wq 保存 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. [root@node1 ~]# udevadm settle 设备上的分区表和内核上的分区表同步 [root@node1 ~]# mkswap /dev/vdb1 格式化swap分区 Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) no label, UUID=166ba987-27e2-4b71-a0f4-51637b799357 [root@node1 ~]# blkid /dev/vda3: UUID="0eb49537-4c55-4a43-986f-98bd31d7cfd2" TYPE="xfs" PARTUUID="657e7edc-03" /dev/vda1: UUID="3cc65186-5c1a-4b64-937d-76fa3feec0c8" TYPE="xfs" PARTUUID="657e7edc-01" /dev/vda2: UUID="a0f0361a-8846-4d19-ac39-653b0b79aff8" TYPE="swap" PARTUUID="657e7edc-02" /dev/vdb1: UUID="166ba987-27e2-4b71-a0f4-51637b799357" TYPE="swap" PARTUUID="a14f4727-01" [node1 ~]# swapon -a /dev/vdb1 激活swap分区 [root@node1 ~]# swapon -s Filename Type Size Used Priority /dev/vda2 partition 511996 0 -2 /dev/vdb1 partition 1048572 0 -3 [root@node1 ~]# swapoff /dev/vdb1 从激活状态改为停止状态 [root@node1 ~]# swapon -a /dev/vdb1 -p 1 更改优先及为1 (临时设定) [root@node1 ~]# swapon -s Filename Type Size Used Priority /dev/vda2 partition 511996 0 -2 /dev/vdb1 partition 1048572 0 1 永久设定 [root@node1 ~]# swapoff /dev/vdb1 从激活状态改为停止状态 [root@node1 ~]# vim /etc/fstab UUID=3cc65186-5c1a-4b64-937d-76fa3feec0c8 /boot xfs defaults 0 0 UUID=a0f0361a-8846-4d19-ac39-653b0b79aff8 swap swap defaults 0 0 /dev/vdb1 swap swap defaults,pri=1 0 0 root@node1 ~]# swapon -a 激活 [root@node1 ~]# swapon -s Filename Type Size Used Priority /dev/vda2 partition 511996 0 -2 /dev/vdb1 partition 1048572 0 2 删除swap分区 [root@node1 ~]# vim /etc/fstab [root@node1 ~]# swapoff /dev/vdb1 /dev/vdb1 swap swap defaults,pri=1 0 0 删除 [root@node1 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): d 删除 Selected partition 1 Partition 1 has been deleted. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xa14f4727 Command (m for help): wq 保存 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
[root@node1 ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.32.1). 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 (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-10485759, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): +100M Created a new partition 1 of type 'Linux' and of size 100 MiB. Partition #1 contains a swap signature. Do you want to remove the signature? [Y]es/[N]o: y The signature will be removed by a write command. Command (m for help): p Disk /dev/vdb: 5 GiB, 5368709120 bytes, 10485760 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 Disklabel type: dos Disk identifier: 0xa14f4727 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 206847 204800 100M 83 Linux Filesystem/RAID signature on partition 1 will be wiped. Command (m for help): wq The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. [root@node1 ~]# udevadm settle 同步 [root@node1 ~]# mkfs.xfs /dev/vdb1 格式化系统 meta-data=/dev/vdb1 isize=512 agcount=4, agsize=6400 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=25600, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@node1 ~]# mkdir /westos [root@node1 ~]# mount /dev/vdb1 /westos/ [root@node1 ~]# chmod 1777 /westos/ 建立公共目录 [root@node1 ~]# umount /westos 卸载 [root@node1 ~]# mount -o usrquota /dev/vdb1 /westos/ 挂载时开启配额限制 [root@node1 ~]# mount /dev/vdb1 on /westos type xfs (rw,relatime,seclabel,attr2,inode64,usrquota) usrquota 表示配额参数激活 [root@node1 ~]# edquota -u westos 给westos用户设定配额 Disk quotas for user westos (uid 1000): Filesystem blocks soft hard inodes soft hard 表示westos用户在/dev/vdb1上写入的数据大小最多为20M /dev/vdb1 0 0 2048 0 0 0 表示westos在 软限 硬限 表示用户westos 软限 硬限 blocks 已经存在 在设备上有多少个文件 的数据 [root@node1 ~]# su -- westos 切换westos用户 [westos@node1 ~]$ dd if=/dev/zero of=/westos/westosfile bs=1M count=10 截取10M 10+0 records in 10+0 records out 10485760 bytes (10 MB, 10 MiB) copied, 0.00720546 s, 1.5 GB/s [westos@node1 ~]$ dd if=/dev/zero of=/westos/westosfile bs=1M count=20 截取20M 20+0 records in 20+0 records out 20971520 bytes (21 MB, 20 MiB) copied, 0.127126 s, 165 MB/s [westos@node1 ~]$ dd if=/dev/zero of=/westos/westosfile bs=1M count=21 截取21M dd: error writing '/westos/westosfile': Disk quota exceeded 保存超出了限额 21+0 records in 20+0 records out 20971520 bytes (21 MB, 20 MiB) copied, 0.326325 s, 64.3 MB/s [westos@node1 ~]$ du -sh /westos/westosfile 只能写入20M 20M /westos/westosfile 永久设定配额: [root@node1 westos]# vim /etc/fstab /dev/vdb1 /westos xfs defaults,usrquota 0 0 删除配额设定 [root@node1 westos]# vim /etc/fstab 删除 /dev/vdb1 /westos xfs defaults,usrquota 0 0 [root@node1 westos]# quotaoff -uv /dev/vdb1 关闭设备配额 -uv表示关闭用户配额并显示过程 Disabling user quota enforcement on /dev/vdb1 /dev/vdb1: user quotas turned off 或者 [root@node1 westos]# umount /westos 卸载 [root@node1 westos]# mount /dev/vdb1 /westos/ 重新挂载