Centos 系统分区扩容操作指南

  1. 查看现有分区情况

    [root@localhost ~]# lsblk
    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda           8:0    0 557.9G  0 disk
    ├─sda1        8:1    0   200M  0 part /boot/efi
    ├─sda2        8:2    0     1G  0 part /boot
    └─sda3        8:3    0 506.7G  0 part ├─cl-root 253:0    0 475.6G  0 lvm  /└─cl-swap 253:1    0  31.1G  0 lvm  [SWAP]

    从上图可以看出,总共两个磁盘sda和sdb。Sda总共200G是系统盘,实际已经使用了1+49G,也就是还有150G没有分区。sdb数据盘大小是800G。

  2. 查询磁盘名称
    [root@localhost ~]# fdisk -l
    WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 599.0 GB, 598999040000 bytes, 1169920000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk label type: gpt
    Disk identifier: 03442826-9FBF-4E8C-8F85-A82E366EAF5C#         Start          End    Size  Type            Name1         2048       411647    200M  EFI System      EFI System Partition2       411648      2508799      1G  Microsoft basic 3      2508800   1065076735  506.7G  Linux LVM       Disk /dev/mapper/cl-root: 510.7 GB, 510669094912 bytes, 997400576 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/cl-swap: 33.4 GB, 33353105408 bytes, 65142784 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
  3. 继续分区剩余磁盘

    请按照下面的操作步骤执行。

    [root@host-173-84-57-3 ~]# fdisk /dev/sdaWelcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): mCommand actiona   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partitiong   create a new empty GPT partition tableG   create an IRIX (SGI) partition tablel   list known partition typesm   print this menun   add a new partitiono   create a new empty DOS partition tablep   print the partition tableq   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)Command (m for help): nPartition type:p   primary (2 primary, 0 extended, 2 free)e   extendedSelect (default p): pPartition number (3,4, default 3):First sector (104857600-419430399, default 104857600):Using default value 104857600Last sector, +sectors or +size{K,M,G} (104857600-419430399, default 419430399):Using default value 419430399Partition 3 of type Linux and of size 150 GiB is setCommand (m for help): tPartition number (1-3, default 3):Hex code (type L to list all codes): 8eChanged type of partition 'Linux' to 'Linux LVM'Command (m for help): pDisk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x000b804dDevice Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048     2099199     1048576   83  Linux/dev/sda2         2099200   104857599    51379200   8e  Linux LVM/dev/sda3       104857600   419430399   157286400   8e  Linux LVMCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: Device or resource busy.The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe(8) or kpartx(8)Syncing disks.
  4. 查看新增分区
    [root@localhost ~]# fdisk -l
    WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 599.0 GB, 598999040000 bytes, 1169920000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk label type: gpt
    Disk identifier: 03442826-9FBF-4E8C-8F85-A82E366EAF5C#         Start          End    Size  Type            Name1         2048       411647    200M  EFI System      EFI System Partition2       411648      2508799      1G  Microsoft basic 3      2508800   1065076735  506.7G  Linux LVM       Disk /dev/mapper/cl-root: 510.7 GB, 510669094912 bytes, 997400576 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/cl-swap: 33.4 GB, 33353105408 bytes, 65142784 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    
  5. 重启虚拟机:reboot
  6. 创建物理卷
    [root@host-173-84-57-3 ~]# pvcreate /dev/sda3Physical volume "/dev/sda3" successfully created.可以通过下面命令查看物理卷:[root@host-173-84-57-3 ~]# pvdisplay--- Physical volume ---PV Name               /dev/sda2VG Name               clPV Size               49.00 GiB / not usable 3.00 MiBAllocatable           yes (but full)PE Size               4.00 MiBTotal PE              12543Free PE               0Allocated PE          12543PV UUID               2P0itU-F3nK-fcbJ-DY8G-GULd-c3DH-eO4COe"/dev/sda3" is a new physical volume of "150.00 GiB"--- NEW Physical volume ---PV Name               /dev/sda3VG NamePV Size               150.00 GiBAllocatable           NOPE Size               0Total PE              0Free PE               0Allocated PE          0PV UUID               o8zfwf-Fpr3-ZB36-Qknr-c3Mn-83Ml-BQ2G9D
  7. 扩容卷组                                                                                                                                                                                      

    先查看现有卷组名称

    将物理卷添加到cl卷组中,并查看扩容结果。

                               

  8. 扩容逻辑卷

    首先查看现有逻辑卷

    需要扩容到/dev/cl/root,目前普遍是这个目录满了。

    执行扩容逻辑卷命令。

    [root@host-173-82-57-33 ~]# lvextend -L +149G /dev/cl/root

     Insufficient free space: 38400 extents needed, but only 38399 available

    注意:扩容150G会发现差一点,统一写149G就可以了。如果系统盘是100G,那就填49G.

  9. 扩大文件系统

  10. 确认结果

从上图可以看出原有分区已经扩容完成。

Centos 系统分区扩容操作指南相关推荐

  1. linux根分区扩容教程,Linux教程CentOS根分区扩容方法

    玩蛇网推荐图文教程:python 列表 Linux教程CentOS根分区扩容方法,操作环境介绍: [root@linuxidc ~]# uname -a Linux linuxidc 2.6.32-3 ...

  2. centos根分区扩容,扩展磁盘

    我们使用centos系统过程被提示空间不足,大概率是根分区满了,要进行扩容 1. 查看磁盘使用情况,发现根分区可用容量只有14M了 df -h 2.查看硬盘数量和分区情况,sbd为新磁盘且未进行分配 ...

  3. 【银河麒麟V10】【服务器】系统分区扩容

    一.麒麟服务器系统分区说明 1.自动分区 银河麒麟V10服务器版默认的自动分区方案使用的是lvm分区(含root.backup和swap分区),有利于满足后期分区大小的动态调整 如下图可以看到,默认分 ...

  4. centos根分区扩容方法linux公社,Centos5给/根分区扩容

    终于还是找到了.现在将执行代码贴出来.希望对大家有帮助! [root@localhost ~]# fdisk /dev/hda3 The number of cylinders for this di ...

  5. 增加ESXI中虚拟机CENTOS系统分区容量

    一.使用虚拟机安装的centos 6.2 x64,分区时把u01分小了,在原硬盘的基本上增加50G,可重启后需要调整分区容量. 原分区如下: [oracle@oracleone ~]$ df -h   ...

  6. centos根分区扩容方法linux公社,CentOS根分区扩容方法

    操作环境:[root@linuxidc ~]# uname -aLinux linuxidc 2.6.32-358.18.1.el6.x86_64#1 SMP Wed Aug 28 17:19:38 ...

  7. Centos系统磁盘扩容

    centos服务器是搭建在ESXI之上,用户反映不能进行无线认证,检查发现openportal没有启动,查看日志发现文件写入失败磁盘已满. du -sm * | sort -n /usr/openpo ...

  8. Google Pixel 刷机、OpenGApps和系统分区扩容

  9. Win7系统分区(C盘)扩容的一种可行的解决方案

    Windows系统的系统分区(一般就是C盘)随着补丁的一次次安装,剩余空间会越来越小,怎么办? 除了在一开始就分很大的空间给系统分区(C盘)的方法外,其实还可以考虑后期扩容的解决方案. 下面描述一种验 ...

最新文章

  1. 华人计算机视觉鼻祖、双院外籍院士黄煦涛逝世,昔日名师门徒遍天下
  2. 扩增子分析流程1. QIIME虚拟机安装配置及挂载外部目录
  3. (王道408考研操作系统)第三章内存管理-第一节6-1:非连续分配管理方式之基本分页存储管理
  4. VGGNet原理和实现
  5. ORACLE 中ROWNUM用法总结!
  6. Docker开启和关闭容器自启动
  7. (四)Linux 安装 jdk
  8. 机器学习 - [集成学习]Bagging算法的编程实现
  9. 阿里云开发者大赛记事
  10. IEC104规约调试
  11. 计算机考试自动填充,Excel函数自动判断、填充信息
  12. 为什么要创建SRT?
  13. 前端实现扫码数据展示
  14. pt-table-checksum 使用实践
  15. 基于FPGA的UART串口通信实验(VHDL语言实现)
  16. 苹果手机上运行python_手机上运行Python
  17. c语言二级常考算法大全,二级C语言 常用算法.doc
  18. XMLHttpRequest.send()
  19. tomcat与servlet共存时报错 org.apache.catalina.LifecycleException:
  20. innodb的写缓存

热门文章

  1. 人工智能AI论文优选:AI简史A BRIEF HISTORY OF AI: HOW TO PREVENT ANOTHER WINTER
  2. 如何评定MES管理系统实施的成功与失败
  3. GoSword 开源前后端分离后台管理框架
  4. 愚蠢的人总是力图赢得辩论,聪明的人则寻求获利
  5. 支付宝被攻击引发备付金监管问题
  6. 从苏宁电器到卡巴斯基(第二部)第29篇:我当高校教师的这几年 V
  7. 【读书笔记】Profressional ASP.Net MVC2
  8. 如果列出10以内自然数中3或5的倍数,则包括3,5,6,9。那么这些数字的和为23。要求计算得出任意正整数n以内中3或5的倍数的自然数之和。
  9. 12306自动抢票软件哪个好?记者亲测体验
  10. (转)程序员职业规划