当前位置:网站首页>[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

边栏推荐
- IPv6 comprehensive experiment
- Static comprehensive experiment ---hcip1
- 【Day1】 deep-learning-basics
- Occasional pit compiled by idea
- Legion is a network penetration tool
- Evolution from monomer architecture to microservice architecture
- Introduction to extensible system architecture
- Es advanced series - 1 JVM memory allocation
- Quick sort (C language)
- 按键精灵跑商学习-商品数量、价格提醒、判断背包
猜你喜欢

Idea SSH channel configuration
![[Galaxy Kirin V10] [server] failed to start the network](/img/0f/6d2f321da85bd7437d2b86547bd8b4.jpg)
[Galaxy Kirin V10] [server] failed to start the network

uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
![[Galaxy Kirin V10] [server] soft RAID configuration](/img/d5/789387613fafc18f623d0cff45093b.jpg)
[Galaxy Kirin V10] [server] soft RAID configuration

Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address

Evolution from monomer architecture to microservice architecture

leetcode1-3
![[Galaxy Kirin V10] [desktop and server] FRP intranet penetration](/img/54/7d1b8b7b8226e2820635dd04b92d1c.jpg)
[Galaxy Kirin V10] [desktop and server] FRP intranet penetration

【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法

Introduction to tree and binary tree
随机推荐
The bamboo shadow sweeps the steps, the dust does not move, and the moon passes through the marsh without trace -- in-depth understanding of the pointer
【Day2】 convolutional-neural-networks
Error C4996 ‘WSAAsyncSelect‘: Use WSAEventSelect() instead or define _ WINSOCK_ DEPRECATED_ NO_ WARN
[Galaxy Kirin V10] [server] KVM create Bridge
使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
The future education examination system cannot answer questions, and there is no response after clicking on the options, and the answers will not be recorded
PHP代码审计3—系统重装漏洞
如果不知道這4種緩存模式,敢說懂緩存嗎?
Map container
Add t more space to your computer (no need to add hard disk)
Legion is a network penetration tool
[Galaxy Kirin V10] [server] system startup failed
MongoDB数据日期显示相差8小时 原因和解决方案
Reasons and solutions for the 8-hour difference in mongodb data date display
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
入职中国平安三周年的一些总结
If you don't know these four caching modes, dare you say you understand caching?
Batch distribution of SSH keys and batch execution of ansible
From programmers to large-scale distributed architects, where are you (I)
Seven examples to understand the storage rules of shaped data on each bit