最近我在学习分区时,我咨询了一位朋友。与他相比,我要崇拜。他提到,在实际操作中,硬盘上的分区很少。现在它实际上已经生产出来了。它们都以“ T”开头,因此我可以了解分区分区的知识,然后阅读Internet上的一些文档,然后与我自己的系统结合起来执行分区安装和其他操作。
首先,将新的8T硬盘添加到虚拟机。添加完成后,重新启动虚拟机。
查看当前分区
[root@mytest ]# fdisk -l Disk /dev/sda: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 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 /dev/sdb: 8589.9 GB, 8589934592000 bytes 255 heads, 63 sectors/track, 1044333 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: 0x00000000
磁盘/ dev / sdb:858 9. 9 GB显示我新添加的硬盘为8T
我现在要对8T硬盘进行分区(主分区:100G,第二个分区为7. 6T,第三个分区为100G)

#Partition / dev / sdb(8T)
[root@mytest /]# parted /dev/sdb GNU Parted 2.1 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands
#由于新安装的硬盘类似于Windows下的分区,因此MBR格式转换为gpt格式(关于MBR格式和GPT格式的优缺点,您可以自己百度。)
(parted) mklabel gpt #硬盘转换为gpt格式
(parted) mkpart primary ext4 # 划分一个100G的主分区 Start? 1 End? 100G
#划分第二个分区
(parted) mkpart Partition name? []? #为了后面好分区时好分别标注类似于part1,可以直接回车 File system type? [ext2]? #分区格式可以设置,默认是ext2,现在可以直接回车,一会要格式化 Start? 101G End? 7700G Warning: You requested a partition from 201MB to 7700GB. The closest location we can manage is 200GB to 7700GB. Is this still acceptable to you? #是否确定这样分区 Yes/No? y #确认 y #划分第三个分区 (parted) mkpart Partition name? []? File system type? [ext2]? Start? 8000G End? 8590G Warning: You requested a partition from 8001MB to 8590MB. The closest location we can manage is 8000GB to 8000GB. Is this still acceptable to you? Yes/No? y Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? i #显示/dev/sdb下划分的分区 (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 8590GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 100GB 100GB primary 3 100GB 100GB 512B 2 101GB 7700GB 7599GB
#从上面可以看到我的第三个分区只有512B,因为我的第三个分区开始于8000,结束于8590(通常,在系统7. 8G实际使用空间中会显示8T硬盘)然后错误出来了。 7700和8000之间是否还有300M?没有进入分区,所以现在我要删除第三个分区并重新分区。
#删除第三个分区
(parted) rm Partition number? 3 #确认删除的分区号 (parted) p #删除完分区后查看当前的分区 Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 8590GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 100GB 100GB primary 2 101GB 7700GB 7599GB
#我刚刚删除了第三个分区,现在将剩余的硬盘空间重新分区(从7701开始)
(parted) mkpart Partition name? []? File system type? [ext2]? Start? 7701 End? -1 # -1 相当于到分区最后 (parted) p Model: VMware, VMware Virtual S (scsi) Disk /dev/sdb: 8590GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 100GB 100GB primary 3 100GB 101GB 1000MB 2 101GB 7700GB 7599GB
(parted) q #已经分完区,退出分区命令 Information: You may need to update /etc/fstab. #提示不要忘记更新/etc/fstab文件
现在,硬盘分区已完成。像Windows一样,分区已完成,需要进行格式化。
现在格式化:
[root@mytest ~]# mke2fs -t ext4 /dev/sdb1 #对第一个分区进行格式化 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 6111232 inodes, 24413696 blocks 1220684 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 746 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/dianqi/article-368963-1.html
你现在就可以去伊拉克竞选总统