首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

linux 将现有分区转换为lvm2分区并扩展放大容量

此次主要进行了/dev/sdb从默认系统转换到lvm系统模式。期间备份恢复数据,不同磁盘下的不同分区创建pv加入同一vg组,放大lv容量,从vg中删除单个pv,通过实验验证lvm2突破了在lvm1版本时pe size大小限制vg大小的限制,自动挂载lv等。 期间经历重启由于fstab文件忘记修改导致无法开机,后进入单用户救援模式修改/etc/fstab后恢复,经过此番折腾更加深入了解了linux的磁盘文件系统模式。 1、查看现有系统信息。 [root@localhost ~]# df 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/sda2 99190032 4077672 89992368 5% / /dev/sdb1 567161764 246748 537640172 1% /opt /dev/sda1 99098 12238 81743 14% /boot tmpfs 8196244 0 8196244 0% /dev/shm [root@localhost ~]# fdisk /dev/sdb The number of cylinders for this disk is set to 72891. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): p Disk /dev/sdb: 599.5 GB, 599550590976 bytes 255 heads, 63 sectors/track, 72891 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 * 1 72891 585496926 83 Linux 2、备份数据,将原先/opt下的文件复制到新建的mkdir /optbak下,已做备份。 [root@localhost ~]# ll /opt/ 总计 32 drwxr-xr-x 2 root root 4096 01-27 15:20 disk drwx------ 2 root root 16384 01-22 15:40 lost+found drwxr-xr-x 3 root root 4096 01-23 12:54 svn drwxrwxrwx 3 root root 4096 02-02 16:50 svntongbu drwxr-xr-x 5 root root 4096 01-30 14:43 wzcs 执行cp -r /opt /optbak后 [root@localhost ~]# ll /optbak/opt/ 总计 20 drwxr-xr-x 2 root root 4096 02-08 15:48 disk drwx------ 2 root root 4096 02-08 15:48 lost+found drwxr-xr-x 3 root root 4096 02-08 15:48 svn drwxr-xr-x 3 root root 4096 02-08 15:48 svntongbu drwxr-xr-x 5 root root 4096 02-08 15:48 wzcs 3、执行umount /opt 写在文件挂载,这时/opt 目录下的文件已经看不到了,因为它所挂载的硬盘已被从文件系统卸载了。但是/opt目录仍然存在,只是成空文件夹了。 [root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda2 95G 4.0G 86G 5% / /dev/sda1 97M 12M 80M 14% /boot tmpfs 7.9G 0 7.9G 0% /dev/shm 4、现在开始执行将原有磁盘系统转化为lvm,因为服务器原先有两块磁盘sda sdb,sda为系统盘 其中sda3已经设置为了lvm分区,sdb这块磁盘由于我只分了一个区现在我需要把它删了重建。 [root@localhost ~]# fdisk /dev/sdb T

04
领券