linux系统磁盘分区之fdisk下载
对于学习磁盘分区,通常学习的都是fdisk命令当然,对于小于2TB的磁盘,我们基本上是使用fdisk命令进行分区下面就简单介绍一下fdisk操作磁盘的基本命令和场景模拟常用命令介绍 fdisk -l 查看所有磁盘信息 fdisk /dev/sdb 使用fdisk命令工具操作/dev/sdb磁盘 m 显示所有的命令信息、用法 p 显示分区信息 q 退出 w 保存分区信息,只有执行了w命令后才会把分区信息写入到磁盘 d 1 删除磁盘的第一个分区场景模拟有一个1G的磁盘/dev/sdb分区为一个主分区,一个扩展分区,大小都为200M其中在扩展分区上面建立一个100M的逻辑分区 /dev/sdb5格式化文件系统为 mkfs.ext4实现开机自动挂载到目录 /backup31 使用fdisk命令工具操作磁盘/dev/sdb fdisk /dev/sdb2 创建一个主分区 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130): +400M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 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: 0x0004a98a Device Boot Start End Blocks Id System /dev/sdb1 1 52 417658+ 83 Linux3 创建一个扩展分区 Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 2 First cylinder (53-130, default 53): Using default value 53 Last cylinder, +cylinders or +size{K,M,G} (53-130, default 130): +400M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 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: 0x0004a98a Device Boot Start End Blocks Id System /dev/sdb1 1 52 417658+ 83 Linux /dev/sdb2 53 104 417690 5 Extended4 创建一个逻辑分区 Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (53-104, default 53): Using default value 53 Last cylinder, +cylinders or +size{K,M,G} (53-104, default 104): +100M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 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: 0x0004a98a Device Boot Start End Blocks Id System /dev/sdb1 1 52 417658+ 83 Linux /dev/sdb2 53 104 417690 5 Extended /dev/sdb5 53 66 112423+ 83 Linux 5 保存 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.6 对磁盘进行分区 [root@hsj2 ~]# mkfs.ext4 /dev/sdb1mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)Stride=0 blocks, Stripe width=0 blocks104448 inodes, 417656 blocks20882 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=6763315251 block groups8192 blocks per group, 8192 fragments per group2048 inodes per groupSuperblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 31 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override. //www.dnzg.cn[root@hsj2 ~]# mkfs.ext4 /dev/sdb5mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)Stride=0 blocks, Stripe width=0 blocks28112 inodes, 112420 blocks5621 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=6737100814 block groups8192 blocks per group, 8192 fragments per group2008 inodes per groupSuperblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729Writing inode tables: doneCreating journal (4096 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 31 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.ok,搞定
本文来自系统大全为您分享如需转载请注明!推荐win10下载
下载仅供下载体验和测试学习,不得商用和正当使用。