首页 > 代码库 > Linux的磁盘分区
Linux的磁盘分区
磁道:track
扇区:sector
磁头:head
柱面:cylinder
每个扇区,512字节
每个磁道划分为63个扇区
逻辑磁头(盘面)数设为255
一个柱面的大小
=255 * 63 * 512 = 8M
硬盘或分区的容量
=柱面大小 * 柱面数
[root@localhost ~]# fdisk -l ###fdisk查看磁盘列表 fdisk -l /dev/sdb 单独查看一块磁盘Disk /dev/sda: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 25 200781 83 Linux/dev/sda2 26 156 1052257+ 82 Linux swap / Solaris/dev/sda3 157 5221 40684612+ 83 LinuxDisk /dev/sdb: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdb doesn‘t contain a valid partition table
划分新的磁盘
Command (m for help): mCommand action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition‘s system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
常用的划分参数:n 增加新的分区 t 修改存在分区 w 保存退出 q 不保存退出
按照提示进行划分,分区大小直接 +xG
划分结束后:partprobe /dev/sdb 识别新的分区表
[root@localhost ~]# fdisk -l /dev/sdbDisk /dev/sdb: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sdb1 1 1217 9775521 83 Linux/dev/sdb2 1218 2434 9775552+ 83 Linux/dev/sdb3 2435 5221 22386577+ 5 Extended/dev/sdb5 2435 2557 987966 82 Linux swap / Solaris/dev/sdb6 2558 3166 4891761 b W95 FAT32
格式化分区
mkfs make filesystem mkfs -t ext3/vfat /dev/sdb1
通过ls /sbin/mkfs* 可以查看可以格式化的文件类型
挂载分区
mount /dev/sdb1 /mnt/part1
umount /dev/sdb1 umount /mnt/part1
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。