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 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = 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  Linux

Disk /dev/sdb: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesnt contain a valid partition table

 划分新的磁盘

Command (m for help): m
Command 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 partitions 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/sdb

Disk /dev/sdb: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = 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

 

Linux的磁盘分区,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。