Linux 扩展/dev/mapper/VolGroup-lv_root容量

Linux  扩展/dev/mapper/VolGroup-lv_root容量

Max.Bai

2018-05


记录一次centos磁盘空间不足,扩展磁盘空间的过程。

使用中发现/dev/mapper/VolGroup-lv_root 使用100%,总空间有15G,下面就扩展磁盘空间过程做一个记录。

# Step 0: 查看磁盘空间,lv_root 经常100%,目的扩容 lv_root
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       12G  3.2G  7.7G  30% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             485M   32M  429M   7% /boot
# Step 1:给VM添加磁盘大小,原来15G ,选择磁盘,扩展,扩容增加到100G,此处不贴图了
# Step 2:fdisk 查看磁盘信息
[root@localhost ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes  				# 磁盘扩容到100G
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c9934

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2089    16264192   8e  Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 12.5 GB, 12490637312 bytes
255 heads, 63 sectors/track, 1518 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 4160 MB, 4160749568 bytes
255 heads, 63 sectors/track, 505 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

#Step 3:fdisk 进入/dev/sda, 创建新分区 /dev/sda3
[root@localhost ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n   			# new 新分区
Command action
   e   extended
   p   primary partition (1-4)
p									#	选择主分区
Partition number (1-4): 3			#   分区序号 3
First cylinder (2089-13054, default 2089): 				# 分区开始块,回车使用默认
Using default value 2089
Last cylinder, +cylinders or +size{K,M,G} (2089-13054, default 13054): 				# 分区结束块,回车使用默认
Using default value 13054

Command (m for help): t				# 修改分区格式
Partition number (1-4): 3			# 选择分区序号
Hex code (type L to list codes): 8e			# 格式选择8e   linux LVM
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): p				# 显示分区信息

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c9934

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2089    16264192   8e  Linux LVM
/dev/sda3            2089       13054    88079039   8e  Linux LVM			# 新建的分区,格式8e

Command (m for help): w						# 保存信息
The partition table has been altered!

# Step 4:重启
[root@localhost ~]# shutdown -r now

# Step 5:创建物理卷
[root@ganxide ~]# pvcreate /dev/sda3
  Writing physical volume data to disk "/dev/sda3"
  Physical volume "/dev/sda3" successfully created
# Step 6: 查看新建的物理卷和大小
[root@ganxide ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup								# lv_root卷组
  PV Size               15.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              3970
  Free PE               0
  Allocated PE          3970
  PV UUID               1GHup8-7fYH-IpYZ-QPgO-cxSl-on5z-M9oPrU
   
  "/dev/sda3" is a new physical volume of "84.00 GiB"			#新的物理卷
  --- NEW Physical volume ---
  PV Name               /dev/sda3								# 卷名
  VG Name               										# 卷组
  PV Size               84.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               ZnLTXE-nGPK-jQAq-wMwy-f1Mb-5cvQ-4lhkmU

# Step 7:添加新的物理卷到lv_root同一个卷组
[root@ganxide ~]# vgextend VolGroup /dev/sda3
  Volume group "VolGroup" successfully extended

# Step 8:查看卷组信息
[root@ganxide ~]# vgdisplay                  
  --- Volume group ---
  VG Name               VolGroup
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               99.50 GiB
  PE Size               4.00 MiB
  Total PE              25473
  Alloc PE / Size       3970 / 15.51 GiB
  Free  PE / Size       21503 / 84.00 GiB								# 未分配空间
  VG UUID               pwCU5u-NikD-vMp3-goth-CXJU-Pf18-0ihmoV

# Step 9:增加lv_root的大小,增加50G
[root@ganxide ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       12G  5.3G  5.7G  49% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             485M   32M  429M   7% /boot

[root@ganxide ~]# lvresize -L +50G   /dev/mapper/VolGroup-lv_root
  Extending logical volume lv_root to 61.63 GiB
  Logical volume lv_root successfully resized

# Step 10:重新识别大小, xfs_qrowfs 是centos7的命令,在centos6.X中是resize2fs
[root@ganxide ~]# resize2fs /dev/mapper/VolGroup-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 4
Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 16156672 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-lv_root is now 16156672 blocks long.

# Step 11:查看扩容后的大小
[root@ganxide ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       61G  5.3G   53G  10% /						# 空间增加到61G 原来只有15G
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             485M   32M  429M   7% /boot

参考:

http://m.111cn.net/art-102479.htm

http://www.mamicode.com/info-detail-1448085.html





  • 6
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
/dev/mapper/vg_icps-lv_rootLinux系统中的一个逻辑卷,而不是内存。如果你的系统出现内存不足的情况,可能是由于系统运行的应用程序占用了太多的内存资源。你可以通过以下方法来解决内存不足的问题: 1. 检查系统中是否有运行中的应用程序占用了过多的内存资源。你可以使用top命令或者htop命令来查看系统中正在运行的进程以及它们所占用的内存大小。根据这些信息,你可以决定是否需要关闭或者限制某些应用程序的内存使用。 2. 可以通过增加系统的物理内存来解决内存不足的问题。如果你的系统经常出现内存不足的情况,可能说明你的系统配置不足以支持当前的应用负载。通过增加物理内存,可以提供更多的内存资源给系统使用。 3. 如果你的系统支持,你也可以尝试使用交换空间扩展系统的内存容量。交换空间是一块硬盘空间,在系统内存不足时可以用来充当额外的内存。但是需要注意的是,由于硬盘的读写速度相对较慢,所以使用交换空间可能会导致系统性能下降。 请根据具体情况选择适合的方法来解决内存不足的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [/dev/mapper/vg_xxx-lv_root 100% 磁盘打满解决方式及思路](https://blog.csdn.net/qq_39390545/article/details/107155508)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值