Linux硬盘扩容LVM逻辑卷管理详细操作手册.docx
《Linux硬盘扩容LVM逻辑卷管理详细操作手册.docx》由会员分享,可在线阅读,更多相关《Linux硬盘扩容LVM逻辑卷管理详细操作手册.docx(18页珍藏版)》请在三一办公上搜索。
1、Linux6.4硬盘扩容LVM逻辑卷管理操作手册1.对新增加的硬盘进行分区、格式化=11.1. 用root用户登录系统使用SSH客户端登录Linux服务器。1.2, 查看挂载情况(此步可省略)(加上-T这个参数,就可以列出所有系统挂载的分区的文件类型信息)rootservername # df -lh文件系统容量已用可用己用%挂载点/dev/sda395G 4.0G86G5% /tmpfs3.9G72K 3.9G1% /dev/shm/dev/sda1388M37M 331M 10% /bootrootservername #1.3. 查看磁盘情况(此步不建议省略)下方红色字为要创建分区的硬盘
2、。rootservername # fdisk -lDisk /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: 0x000bf627Block
3、s Id System40960083 Linux419430482 Linux swapDevice Boot StartEnd/dev/sda1*152Partition 1 does not end on cylinder boundary. /dev/sda252574/ Solaris Partition 2 does not end on cylinder boundary./dev/sda35741305510025267283 LinuxDisk/dev/sdb: 1073.7 GB, 1073741824000 bytes 255 heads, 63 sectors/trac
4、k, 130541 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: 0x00000000rootservername #1.4. 创建分区下方红色字为要创建分区的硬盘注意跟上面查看到的要对应。rootservername # fdisk/dev/sdbDevice contains ne
5、ither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x883e515a.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content wont be recoverable.Warning: invalid flag 0x0000 of partition t
6、able 4 will be corrected by w(rite)WARNING: DOS-compatible mode is deprecated. Its strongly recommended to switch off the mode (command c) and change display units to sectors (command u).Command (m for help): n新增加一个分区Command actione extendedp primary partition (1-4)p分区类型我们选择为主分区Partition number (1-4
7、): 1分区编号选1,如果被占依此类推First cylinder (1-130541, default 1):按回车默认(起始扇区)Using default value 1Last cylinder, +cylinders or +sizeK,M,G (1-130541, default 130541):按回车默 认(结束扇区)也可以使用+100M即创建100M的分区也可以使用(K,M,G) Using default value 130541Command (m for help): w写分区表(可以输入t进行分区格式调整,见1.6 调整分区格式)The partition table
8、has been altered!Calling ioctl() to re-read partition table.Syncing disks.rootservername #1.5. 重新查看磁盘情况(此步可省略)下方红色字为新创建的磁盘分区信息。rootservername # fdisk -lDisk /dev/sda: 107.4 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector siz
9、e (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000bf627Device BootStartEndBlocks IdSystem/dev/sda1 *15240960083 LinuxPartition 1 does not end on cylinder boundary./dev/sda252574419430482 Linux swap/ SolarisPartition 2 does not end on
10、cylinder boundary./dev/sda35741305510025267283 LinuxDisk /dev/sdb: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk ide
11、ntifier: 0x883e515aDevice Boot StartEnd Blocks Id System/dev/sdb11130541 104857055183 Linuxrootservername #1.6. 调整分区格式(可以跟创建分区合并执行)我们的新建分区,却不是LVM的。所以,接下来使用fdisk将其改成LVM的, 使用LVM逻辑卷管理可以方便以后扩容。rootservername # fdisk /dev/sdbWARNING: DOS-compatible mode is deprecated. Its strongly recommended to switch o
12、ff the mode (command c) and change display units to sectors (command u).Command (m for help): t 修改分区类型Selected partition 1选分区1 (与上面新创建的分区要对应)Hex code (type L to list codes): 8e 修改为 LVM 类型(8e 就是 LVM)Changed system type of partition 1 to 8e (Linux LVM)Command (m for help): w 写分区表The partition table ha
13、s been altered!Calling ioctl() to re-read partition table.Syncing disks.rootservername #1.7. 重启服务器rootservername # rebootBroadcast message from rootservername(/dev/pts/0) at 15:30 .The system is going down for reboot NOW!rootservername #1.8. 分区格式化下方红色字为要格式化的分区,要与上面新创建分区的对应。(如果不确定 可以执行fdisk -l查看磁盘情况,
14、见1.5重新查看磁盘情况)rootservername # mkfs.ext4 /dev/sdb1mke2fs 1.41.12 (17-May-2010)文件系统标签=操作系统:Linux块大小=4096 (log=2)分块大小=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks65536000 inodes, 262142637 blocks13107131 blocks (5.00%) reserved for the super user 第一个数据块=0Maximum filesystem blocks=42949672968000 b
15、lock groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,102400000, 214990848正在写入inode表:完成Creating jou
16、rnal (32768 blocks):完成Writing superblocks and filesystem accounting information: 完成This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. rootservername #2. 创建LVM卷组分区添加到卷组创建卷实 现扩容2.1. 硬盘分区初始化为物理卷pvcreate指令用于将物理硬盘分区初始化为物理卷,以
17、便被LVM使用。 下方红色字为要初始化为物理卷的分区,要与上面新创建分区的对应。rootservername # lvmlvmpvcreate /dev/sdb1Physical volume /dev/sdb1 successfully created lvm2.2. 创建逻辑卷组vgcreate命令执行几个操作。除了创建company卷组以外,它还设置-5-/dev/sdbl,使它使用32 MB的范围,并将引导的最大逻辑卷大小增加到2TB(默 认4M最大支持256G)下方红色字为要创建逻辑卷组的物理分区,要与上面新创建分区的对应,蓝 色字为要创建的卷组名。lvmvgcreate -s 32
18、M company/dev/sdblVolume group company successfully created lvm2.3. 激活分区(默认激活)lvmvgchange -a y company0 logical volume(s) in volume group company now active2.4. 将分区加入到逻辑卷组lvmvgextend company/dev/sdblPhysical volume /dev/sdbl is already in volume group company Unable to add physical volume /dev/sdbl
19、to volume group company.2.5. 创建逻辑卷在最初时将它的大小设置为4.96G,并称它作data,最后要跟着逻辑卷组 名。下方蓝色字为新创建的卷组名,橘黄色为要创建的逻辑卷,红色字为要创建 的逻辑卷大小(注意如分配了 5G的硬盘空间可能只能创建4.96G逻辑卷大小, 此处需要一点点试直到创建成功)。进行一点点减少容量尝试创建(比较space (3l999 extents): 34359 required. 差距然后减少创建的容量,直到出现Logical volume data created”表示创建 成功)。lvmlvcreate -L l073.7G -n comp
20、anyRounding up size to full physical extent l.05 TiBVolume group company has insufficient free space (3l999 extents): 34359 required.lvmlvcreate -L l.05T -n companyRounding up size to full physical extent l.05 TiBVolume group company has insufficient free space (31999 extents): 34407 required.lvmlvc
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Linux 硬盘 扩容 LVM 逻辑 管理 详细 操作手册
链接地址:https://www.31ppt.com/p-4886097.html