Linux实战------扩展根目录

这篇博客介绍了如何扩展Linux系统的根目录。首先通过lsblk查询可用磁盘,然后使用fdisk创建新分区。接着创建物理卷,并将新分区与原有的卷组合并。确定挂载点后,创建逻辑卷,并在/dev/mapper/centos-root目录扩展空间,最终成功增加30GB容量。
摘要由CSDN通过智能技术生成

1. 首先要与一块可用的磁盘。可用 lsblk 查询。

2.  fdisk /dev/sda  创建新的分区 # sda根据自己的实际情况来修改,你需要挂载哪一块盘,就选定哪一块盘。可以先使用lsblk查询有哪些盘是空闲的

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

命令(输入 m 获取帮助):m
命令操作
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

命令(输入 m 获取帮助):n
All primary partitions are in use
添加逻辑分区 8
起始 扇区 (803241984-908099583,默认为 803241984):                           # 我这里只准备创建一个卷,用的整个空白分区,所以都直接直接enter键使用默认值,  也可以自己手动修改为范围内的值
将使用默认值 803241984
Last 扇区, +扇区 or +size{K,M,G} (803241984-908099583,默认为 908099583):
将使用默认值 908099583
分区 8 已设置为 Linux 类型,大小设为 50 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sda:500.1 GB, 500107862016 字节,976773168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:dos
磁盘标识符:0x1f4a1000

   设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   167776255    83887104    7  HPFS/NTFS/exFAT
/dev/sda2       167778302   908099583   370160641    f  W95 Ext'd (LBA)
Partition 2 does not start on physical sector boundary.
/dev/sda3       908099584   9101
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值