资源预览内容
第1页 / 共18页
第2页 / 共18页
第3页 / 共18页
第4页 / 共18页
第5页 / 共18页
第6页 / 共18页
第7页 / 共18页
第8页 / 共18页
第9页 / 共18页
第10页 / 共18页
亲,该文档总共18页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
-1-Linux6.4 硬盘扩容 LVM 逻辑卷管理操作手册1.对新增加的硬盘进行分区、格式化1.1. 用 root 用户登录系统使用 SSH 客户端登录 Linux 服务器。1.2. 查看挂载情况(此步可省略)(加上-T 这个参数,就可以列出所有系统挂载的分区的文件类型信息)rootservername # df -lh文件系统 容量 已用 可用 已用% 挂载点/dev/sda3 95G 4.0G 86G 5% /tmpfs 3.9G 72K 3.9G 1% /dev/shm/dev/sda1 388M 37M 331M 10% /bootrootservername #1.3. 查看磁盘情况(此步不建议省略)下方红色字为要创建分区的硬盘。rootservername # fdisk -lDisk /dev/sda: 107.4 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000bf627Device Boot Start End Blocks Id System/dev/sda1 * 1 52 409600 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 52 574 4194304 82 Linux swap / SolarisPartition 2 does not end on cylinder boundary.-2-/dev/sda3 574 13055 100252672 83 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 identifier: 0x00000000rootservername #1.4. 创建分区下方红色字为要创建分区的硬盘注意跟上面查看到的要对应。rootservername # fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding 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 table 4 will be corrected by w(rite)WARNING: DOS-compatible mode is deprecated. Its strongly recommended toswitch off the mode (command c) and change display units tosectors (command u).Command (m for help): n 新增加一个分区Command actione extendedp primary partition (1-4)p 分区类型我们选择为主分区Partition number (1-4): 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 has been altered!-3-Calling ioctl() to re-read partition table.Syncing disks.rootservername #1.5. 重新查看磁盘情况(此步可省略)下方红色字为新创建的磁盘分区信息。rootservername # fdisk -lDisk /dev/sda: 107.4 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000bf627Device Boot Start End Blocks Id System/dev/sda1 * 1 52 409600 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 52 574 4194304 82 Linux swap / SolarisPartition 2 does not end on cylinder boundary./dev/sda3 574 13055 100252672 83 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 identifier: 0x883e515aDevice Boot Start End Blocks Id System/dev/sdb1 1 130541 1048570551 83 Linuxrootservername #1.6. 调整分区格式(可以跟创建分区合并执行)我们的新建分区,却不是 LVM 的。所以,接下来使用 fdisk 将其改成 LVM的,使用 LVM 逻辑卷管理可以方便以后扩容。-4-rootservername # fdisk /dev/sdbWARNING: DOS-compatible mode is deprecated. Its strongly recommended toswitch off the mode (command c) and change display units tosectors (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 has 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 查看磁盘情况,见 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 blocks-5-65536000 inodes, 262142637 blocks13107131 blocks (5.00%) reserved for the super user第一个数据块=0Maximum filesystem blocks=42949672968000 block 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, 214990
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号