暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
增加根目录.txt
261
6页
4次
2021-09-28
免费下载
根据提示可以看到此系统的磁盘接口为 scsi,对应‘sda',下面进行分区:
更可以根据提示输入 m 查看帮助信息,再输入 n(表示增加分区),回车后输入 p(创建主分区)
回车后 partition number 输入 3(因为上面已经有两个分区 sda1 sda2)
回车会提示输入分区的 start (通过 fdisk -l 可以看出 sda2 end 值为 40960)
我们可以指定 start 值为 40961end 值为默认即可(即当前最大值),回车后输入 W 进行保存,分区划分完
毕。
可以看到/dev/sda4 Id 号为 83,我们要将其改成 8e(LVM 卷文件系统的 Id),具体方法同上,如下图所
示:
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 at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
重启系统,格式化新添加的分区。
3. 扩展文件系统
将该分区创建为文件系统:
创建 PV
pvdisplay 当前的物理卷
pvcreate 指令用于将物理硬盘分区初始化为物理卷,以便被 LVM 使用。要创建物理卷必须首先对硬盘进行
分区,并且将硬盘分区的类型设置为“8e”后,才能使用 pvcreat 指令将分区初始化为物理卷。
扩展 VG
当前需要扩充的 lvm 组名,可以通过 vgdisplay 查看:
vgextend 指令用于动态的扩展卷组,它通过向卷组中添加物理卷来增加卷组的容量。
可以看出可扩展的空间为 10GB,接下来进行 LV 扩展,扩展空间要小于 VG Free PE 的大小,即小于
10GB
lvextend 命令用于扩展空间,如下面将 root 分区扩展 9.98GB
[root@rac1 ~]# lvextend -L+9.98G /dev/vg_rac1/lv_root /dev/sda4
最后一步 使用 resize2fs 命令,用于扩大或者缩小未挂载的 ext2,ext3 或者是 ext4 文件系统。
文件系统空间已经扩展成功,如果 resize2fs 之后文件系统空间没增加可以尝试重启虚拟机。
f 命令查看自己的/目录属于哪个逻辑卷(我们要做的是对逻辑卷扩展)
[root@redhat6-3 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_redhat63-lv_root
18102140 1298416 15884172 8% /
tmpfs 124592 0 124592 0% /dev/shm
/dev/sda1 495844 29859 440385 7% /boot
新加一块硬盘,我的是 sdb 先创建物理卷
[root@redhat6-3 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel with disk identifier 0xce359e4e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1): (回车,默认将所有空间分配给第一个主分区)
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261):
Using default value 261
Command (m for help): t(修改磁盘格式为 LVM
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
再次查看磁盘情况
[root@redhat6-3 ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
of 6
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜