当前位置:网站首页>[Galaxy Kirin V10] [server] system partition expansion
[Galaxy Kirin V10] [server] system partition expansion
2022-07-04 10:35:00 【GUI Anjun @kylinos】
One 、 Kylin server system partition description
1、 Automatic partition
Galaxy Unicorn V10 The default automatic partition scheme of the server version uses lvm Partition ( contain root、backup and swap Partition ), It is conducive to the dynamic adjustment of partition size in the later stage
As can be seen in the figure below , The default partition scheme is to sda2 Did LVM, The volume group name is klas, Divided into backup、root、swap Three logical volumes , Therefore, the default partition scheme of Kirin system supports root partition 、 Dynamic expansion of swap partition and backup restore partition , and boot Zoning is to ensure the safety and stability of system operation , It was done alone sda1 Independent partition of .
2、 Manual partition
Manual partitioning includes the following four schemes :
a、 Standard zoning : A standard partition can contain a file system or swap space , It can also provide a container , For Software RAID and LVM Physical volume .
b、BTRFS:Btrfs It's a file system with the same characteristics of several devices . It can process and manage multiple files , Large files and large volume ratio ext2,ext3 and ext4 file system .
c、LVM( Logic volume ): Create a LVM Partition automatically generates a LVM Logic volume . LVM When using physical disks , Improve performance . Common partition management cannot change the size of logical partition after it is divided , When a logical partition cannot store a file , This file is limited by the upper file system , It can't be stored across multiple partitions , So you can't put it on another disk at the same time . When a partition runs out of space , The solution is usually to use symbolic links , Or use the partition sizing tool , But it's just a temporary solution , No fundamental solution . With Linux Logical volume management (LVM) Appearance of function , All these problems are solved , Users can easily adjust the size of each partition without downtime .
d、LVM Thin Provisioning : Use thin provisioning , Free space you can manage , It's called the thin pool , It can be used by applications as needed , Any number of storage pools that can be assigned to devices . When the required storage space is allocated cost effectively , Thin pools can be dynamically expanded . Some partitions can only be standard partitions , Even if choose LVM It will also be automatically set as a standard partition .
【 Be careful 】
To facilitate the late dynamic disk expansion , Suggested choice LVM Partition plan .
Two 、 Root partition expansion
1、lvm Capacity expansion under partition policy
As shown in the figure below , At present, the system disk partition adopts the system default lvm Zoning , Whole VG The volume group klas The total size is about 89G, The size of the root partition is about 57G, Now add the new 10G Hard disk sdb Expand to the root partition , Expand the root partition size to 67G.
step 1: establish PV Physical volume
# fdisk /dev/sdb // take sdb Partition
# pvcreate /dev/sdb1 // establish pv Physical volume
# pvs // You can see /dev/sdb1 The physical volume has been created successfully , The size is 10G
step 2: Expand VG The volume group
# vgs // Before expanding the volume group , First look at the current volume group size ,klas The volume group size is 89G
# vgextend klas /dev/sdb1 // Use the new sdb1 Expand to those that need to be expanded klas The volume group
# vgs // You can see klas The volume group consists of the previous 89G Expand the capacity to about 99G
step 3: Expand LV Logic volume
# lvs // View the current logical volume information before expanding
# lvextend -L +9.8G /dev/klas/root // take root Logical volume increase 9.8G, Due to numerical conversion , Cannot actually increase 10G
# lvs // You can see root Partitions have been increased by nearly 10G, But at this time root Partition size or size before expansion , It has not really taken effect
step 4: Expansion takes effect
Increase pair xfs and ext4 Two file system formats , Use two different expansion effective commands
# blkid // Look at the file system format
# xfs_growfs /dev/mapper/klas-root //xfs File system format takes effect root Expansion of partitions
# resize2fs /dev/mapper/klas-root // If it is ext4 The file system format uses resize2fs command
# df -Th // The root partition consists of the original 57G Capacity to 67G
2、 Not lvm Capacity expansion under partition policy
programme 1: Not LVM Expansion and adjustment are not recommended under the partition scheme , Because there is a risk of data loss , If you really need capacity adjustment , You can try to shrink the space under other standard partitions , Add the shrunk part to the partition that needs to be expanded , For example, part or all of /home Space shrinkage under partition , Add root partition , The premise is that the partitions for capacity reduction and expansion must be continuous , And if it is a volume reduction scheme, it must be ext4 File system format , because xfs Format only supports capacity expansion , Shrinking is not supported ,ext4 Support capacity expansion and reduction . Methods can refer to the following links :Linux Zoning adjustment (LVM He Fei LVM Expand and shrink in the environment ) - cyrus0w - Blog Garden
programme 2: Copy and migrate the root partition or the whole system to another new disk with large capacity . The whole Linux The system is migrated to another hard disk - Simple books
programme 3: Make a soft link , Associate the directory with insufficient capacity in the partition to other partition directories with sufficient capacity , Soft links support cross partition links .
3、 ... and 、swap District expansion
Method 1:LVM Capacity expansion
Here's the picture , From the new hard disk sdc In doing lvm, Divide 4G Capacity to swap Partition
# swapoff /dev/klas/swap // close swap Space
# free -m
# fdisk /dev/sdc
# pvcreate /dev/sdc1 // establish pv
# vgextend klas /dev/sdc1 //klas by lvm Volume group name for , Modify... According to the actual situation
# lvextend -L +4G /dev/klas/swap // Capacity expansion swap
# mkswap /dev/klas/swap // establish swap
# swapon /dev/klas/swap /// open swap Space
Method 2: Current hard disk expansion
Not lvm programme , Expand the capacity from the existing hard disk
# free -m // take 4Gswap Partition expansion to 8G
# dd if=/dev/zero of=/root/swapfile bs=1M count=4096 // establish 4G file
# mkswap /root/swapfile // Create exchange file
# chmod 0600 /root/swapfile
# swapon /root/swapfile // Activate swap
# vim /etc/fstab // write in fstab, Power on is effective , Enter the following at the end
/root/swapfile swap swap defautls 0 0
# reboot // Restart the machine to test
Four 、tmp District expansion
programme 1: New disk
Add disk , Mount the disk to /tmp Under the table of contents
programme 2: Local expansion
Expand the capacity on the original basis
# mount -t tmpfs -o size=10G tmpfs /tmp // The original /tmp The contents of the directory will be emptied , Please pay attention to the backup
# vim /etc/fstab // Add the following at the end
tmpfs /tmp tmpfs defaults,size=10G 0 0
边栏推荐
- Laravel文档阅读笔记-How to use @auth and @guest directives in Laravel
- 按键精灵跑商学习-商品数量、价格提醒、判断背包
- DDL statement of MySQL Foundation
- Huge number multiplication (C language)
- Snake (C language)
- From programmers to large-scale distributed architects, where are you (2)
- Rhcsa operation
- The time difference between the past time and the present time of uniapp processing, such as just, a few minutes ago, a few hours ago, a few months ago
- uniapp---初步使用websocket(长链接实现)
- 对于程序员来说,伤害力度最大的话。。。
猜你喜欢
What is an excellent architect in my heart?
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
Rhcsa - day 13
Servlet基本原理与常见API方法的应用
DML statement of MySQL Foundation
uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示
system design
Time complexity and space complexity
Quick sort (C language)
Use the data to tell you where is the most difficult province for the college entrance examination!
随机推荐
Rhsca day 11 operation
Architecture introduction
[Galaxy Kirin V10] [server] system startup failed
六月份阶段性大总结之Doris/Clickhouse/Hudi一网打尽
Lavel document reading notes -how to use @auth and @guest directives in lavel
对于程序员来说,伤害力度最大的话。。。
system design
Learning XML DOM -- a typical model for parsing XML documents
Servlet基本原理与常见API方法的应用
入职中国平安三周年的一些总结
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
Read a piece of text into the vector object, and each word is stored as an element in the vector. Convert each word in the vector object to uppercase letters. Output the converted elements in the vect
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
What is an excellent architect in my heart?
Sword finger offer 31 Stack push in and pop-up sequence
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
VLAN part of switching technology
Const's constant member function after the function; Form, characteristics and use of inline function
RHCE day 3
今日睡眠质量记录78分