Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Chapter 9 LVM Operation-centos7.5 knowledge

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

I. Overview of LVM

Logical Volume Manager, logical volume management

Dynamically adjust disk capacity to improve the flexibility of disk management

Note: / boot partition is used to store boot files and cannot be created based on LVM

Graphical interface management tool

System-config-lvm

Basic Concepts of LVM Mechanism

PV (physical volume)

VG (volume group)

LV (logical volume)

Main command

Function

Physical volume management

Volume group management

Logical volume management

Scan scanning

Pvscan

Vgscan

Lvscan

Create establishment

Pvcreate

Vgcreate

Lvcreate

Display display

Pvdisplay

Vgdisplay

Lvdisplay

Remove deletion

Pvremove

Vgremove

Lvremove

Extend extension

Vgextend

Lvextend

Reduce reduction

Vgreduce

Lvreduce

Main command

Pvcreate device name 1 [device name 2 … []

Vgcreate volume group name physical volume name 1 physical volume name 2

Lvcreate-L capacity size-n logical volume name volume group name

Lvextend-L + size / dev/ volume group name / logical volume name

There are three steps for volume operation:

1. Establish PV

Pvcreate / dev/sdh

Pvcreate / dev/sdi

Pvcreate / dev/sdj

2. Establish VG

Vgcreate vg3disk / dev/sdh / dev/sdi / dev/sdj

3. Create a partition LV

Vgdisplay

Lvcreate-l 381-n lvfilm vg3disk

Use this partition LV

Ll / dev/mapper/

You can then format mkfs.ext4 / dev/mapper/vg3disk-lvfilm

Mounting use

Mount / dev/mapper/vg3disk-lvfilm / mnt/disklv1/

Expand disk space (online)-ext4 partition

1. Newly added and expanded disk: pvcreate / dev/sdk pvcreate / dev/sdl

2. Vgdisplay to view the original VG information

3. Expand operation

Vgextend vg3disk / dev/sdk / dev/sdl

Vgdisplay

Lvextend-l + 510 / dev/mapper/vg3disk-lvfilm

Commands that are in effect online

Resize2fs / dev/mapper/vg3disk-lvfilm

Note: if the xfs partition needs to be extended online, then

Xfs_growfs / dev/mapper/vg3disk-lvfilm

In this way, online disk space expansion is achieved.

II. Disk quota

Conditions for achieving disk quota

Linux kernel support is required

Install xfsprogs and quota software packages

Characteristics of Linux disk quota

Scope: for the specified file system (partition)

Restricted object: user account, group account

Restriction type

Disk capacity (default unit is KB)

Number of Fil

Restriction method

Soft limit

Hard limit

Disk quota management steps

Operation steps (Note: to use XFS partition)

Enable quota support for file system

Add usrquota and grpquota mount parameters

[root@localhost ~] # vi / etc/fstab

…… / / omit some information

/ dev/sdg1 / mailbox xfs defaults,usrquota,grpquota 0 0

[root@localhost] # mount-o remount / mailbox/

[root@localhost ~] # mount

…… / / omit some information

/ dev/sdg1 on / mailbox type xfs (rw,relatime,attr2,inode64,usrquota,grpquota)

[root@localhost ~] # chmod 777 / mailbox/

Edit quota settings for user and group accounts

Use the xfs_quota command to edit quota settings

Xfs_quota-x-c 'limit-u bsoft=N bhard=N isoft=N ihard=N username' mount point

Common option

-u,-g,-x,-c

-u user name limit

-g group name limit

-x expert mode

-c specify command

Restricted field

Bsoft 、 bhard 、 isoft 、 ihard

Verify disk quota function

Switch to the partition where the quota is set (mount directory)

Create a specified number of files: use the touch command, or the cp command

Create a file of specified capacity: use the dd command, or the cp command

View quota usage

Xfs_quota-x-c 'report option' mount point

Common options for report

-a,-I,-b,-u,-g

Examples of operation steps:

Useradd aa1

Add hard disk partitions (format xfs)

Chmod 777 / mailbox/

Set up permanent mount vi / etc/fstab

/ dev/sdm1 / mailbox xfs defaults,usrquota,grpquota 0 0

Mount-o remount / mailbox/

If the order does not take effect, then umount-a; mount-a

Xfs_quota-x-c 'limit-u bsoft=50M bhard=60M isoft=1500 ihard=2000 aa1' / mailbox/

Xfs_quota-x-c 'limit-u bsoft=50M bhard=60M aa2' / mailbox/

Groupadd aagroup

Xfs_quota-x-c 'limit-g bsoft=100M bhard=200M isoft=500 ihard=2500 aagroup' / mailbox/

Xfs_quota-x-c 'limit-g bsoft=50M bhard=60M aagroup' / mailbox/

View quota usage

Xfs_quota-c 'quota-uv zhangsan' / mailbox/

Xfs_quota-c 'quota-gv wangusers' / mailbox

Xfs_quota-x-c 'report-I-ug' / mailbox (check the file count limit)

Xfs_quota-x-c 'report-b-ug' / mailbox (check disk capacity limits)

Assignment:

1. What is the purpose of executing the "mount-o uquota,gquota / dev/mail_store/mbox / mailbox/" command?

2. What is the purpose of executing the command "xfs_quota-c 'quota-uv zhangsan' / mailbox/"?

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report