磁盘配额

磁盘配额,第1张

概述2、为三块硬盘分区 [[email protected] ~]# fdisk /dev/sdf 欢迎使用 fdisk (util-linux 2.23.2)。 更改将停留在内存中,直到您决定将更改写入磁盘。 使用写入命令前请三思。 Device does not contain a recognized partition table 使用磁盘标识符 0xcf3610b6 创建新的 DOS 磁盘标

2、为三块硬盘分区
[[email protected] ~]# fdisk /dev/sdf
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xcf3610b6 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary,0 extended,4 free)
e extended
Select (default p):
Using default response p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区,+扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[[email protected] ~]# fdisk /dev/sde
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xfae43c11 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
[[email protected]localhost ~]# fdisk /dev/sdg
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x0e0afac9 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary,G} (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。


3、创建RAID 5

[[email protected] ~]# mdadm -C /dev/md55 -l 5 -n 3 /dev/sd[efg]
mdadm: /dev/sde appears to be part of a raID array:
level=raID0 devices=0 ctime=Thu Jan 1 08:00:00 1970
mdadm: partition table exists on /dev/sde but will be lost or
meaningless after creating array
mdadm: /dev/sdf appears to be part of a raID array:
level=raID0 devices=0 ctime=Thu Jan 1 08:00:00 1970
mdadm: partition table exists on /dev/sdf but will be lost or
meaningless after creating array
mdadm: /dev/sdg appears to be part of a raID array:
level=raID0 devices=0 ctime=Thu Jan 1 08:00:00 1970
mdadm: partition table exists on /dev/sdg but will be lost or
meaningless after creating array
Continue creating array? y
mdadm: Defaulting to version 1.2 Metadata
mdadm: array /dev/md55 started.
[[email protected] ~]# mdadm -D /dev/md55
/dev/md55:
Version : 1.2
Creation Time : Sat Aug 3 13:45:55 2019
RaID Level : raID5
Array Size : 41910272 (39.97 GiB 42.92 GB)
Used Dev Size : 20955136 (19.98 GiB 21.46 GB)
RaID Devices : 3
Total Devices : 3
Persistence : Superblock is persistent

Update Time : Sat Aug 3 13:46:02 2019
State : clean,degraded,recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1

Layout : left-symmetric
Chunk Size : 512K

Rebuild Status : 10% complete

name : localhost.localdomain:55 (local to host localhost.localdomain)
UUID : 862f8db5:c4a3594c:0a7b4ffa:a5fadc0a
Events : 2

Number Major Minor RaIDDevice State
0 8 64 0 active sync /dev/sde
1 8 80 1 active sync /dev/sdf
3 8 96 2 spare rebuilding /dev/sdg


4、创建物理卷

[[email protected] ~]# pvcreate /dev/md55
Physical volume "/dev/md55" successfully created
[[email protected] ~]# pvscan
PV /dev/sdb1 VG myvg lvm2 [20.00 GiB / 0 free]
PV /dev/sdb2 VG myvg lvm2 [20.00 GiB / 4.99 GiB free]
PV /dev/sda2 VG centos lvm2 [39.51 GiB / 44.00 MiB free]
PV /dev/sdb3 lvm2 [20.00 GiB]
PV /dev/md55 lvm2 [39.97 GiB]
Total: 5 [139.47 GiB] / in use: 3 [79.50 GiB] / in no VG: 2 [59.97 GiB]

5、创建卷组

[[email protected] ~]# vgcreate vg /dev/md55
Volume group "vg" successfully created
[[email protected] ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "myvg" using Metadata type lvm2
Found volume group "vg" using Metadata type lvm2
Found volume group "centos" using Metadata type lvm2

6、创建逻辑卷

[[email protected] ~]# lvcreate -L +30G -n lv vg
Logical volume "lv" created.
[[email protected] ~]# lvscan
ACTIVE ‘/dev/myvg/mylv‘ [35.00 GiB] inherit
ACTIVE ‘/dev/vg/lv‘ [30.00 GiB] inherit
ACTIVE ‘/dev/centos/swap‘ [2.00 GiB] inherit
ACTIVE ‘/dev/centos/root‘ [37.46 GiB] inherit

7、格式化逻辑卷

[[email protected] ~]# mkfs.xfs /dev/vg/lv
log stripe unit (524288 bytes) is too large (maximum is 256KiB)
log stripe unit adjusted to 32KiB
Meta-data=/dev/vg/lv isize=256 agcount=16,agsize=491392 blks
= sectsz=512 attr=2,projID32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=7862272,imaxpct=25
= sunit=128 swIDth=256 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=3840,version=2
= sectsz=512 sunit=8 blks,lazy-count=1
realtime =none extsz=4096 blocks=0,rtextents=0

8、安装apache
[[email protected] ~]# bash yuanma.sh
#!/bin/bash

yum -y install gcc gcc-c++

tar xf httpd-2.2.17.tar.gz -C /usr/src
cd /usr/src/httpd*
./configure --prefix=/usr/local/apache
make
make install
cd /usr/local/apache/conf/
set "s/#Servername w/Servername w" /httpd.conf
/usr/local/apache/bin/apachectl start

yum -y install lynx
lynx 127.0.0.1

9、挂载
[[email protected] ~]# mount -0 usrquota,grpquota /dev/vg/lv /usr/local/apache/htdocs
[[email protected] ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 38G 3.6G 34G 10% /
devtmpfs devtmpfs 985M 0 985M 0% /dev
tmpfs tmpfs 994M 80K 994M 1% /dev/shm
tmpfs tmpfs 994M 8.9M 985M 1% /run
tmpfs tmpfs 994M 0 994M 0% /sys/fs/cgroup
/dev/md5 xfs 20G 33M 20G 1% /data1
/dev/md0 xfs 20G 33M 20G 1% /data2
/dev/sda1 xfs 497M 107M 391M 22% /boot
/dev/mapper/vg-lv xfs 30G 33M 30G 1% /usr/local/apache/htdocs

10、磁盘配额
[[email protected] ~]# quotacheck -auvg
quotacheck: SkipPing /dev/mapper/myvg-mylv [/data]
quotacheck: SkipPing /dev/mapper/vg-lv [/usr/local/apache/htdocs]
quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option.
[[email protected] ~]# quotaon -avug

11、创建index.HTML
[[email protected] ~]# cd /usr/local/apache/htdocs
[[email protected] htdocs]# vim index.HTML
<HTML><body><h1>fuzhengang</h1></body></HTML>

12、创建用户并对LVM配置磁盘配额
[[email protected] ~]#useradd -d /usr/local/apache/htdocs/hfh hfh
[[email protected] ~]# edquota -u hfhdisk quotas for user hfh (uID 1001): filesystem blocks soft hard inodes soft hard /dev/mapper/myvg-mylv 0 0 0 0 0 0 /dev/mapper/vg-lv 12 81920 102400 7 80 100

总结

以上是内存溢出为你收集整理的磁盘配额全部内容,希望文章能够帮你解决磁盘配额所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1020068.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存