Linux磁盘分区格式化(2)

[root@station110 ~]# fdisk -l /dev/sda
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 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: 0x0006e97b
Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          26      204800  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        7859    62914560  8e  Linux LVM
/dev/sda4            7859      15665    62708728+  5  Extended
/dev/sda5            7859      10470    20979859+  83  Linux
/dev/sda6          10471      15665    41728806  83  Linux


[root@station110 ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help):

删除磁盘分区是,注意系统原先存在的主分区不要误删,否则,系统会直接崩溃
Command (m for help): d
Partition number (1-6): 4
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 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: 0x0006e97b
Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          26      204800  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        7859    62914560  8e  Linux LVM

直接创建扩展分区
Command (m for help): n
Command action
e  extended
p  primary partition (1-4)
e
Partition number (1-4): 4
First cylinder (7859-15665, default 7859):
Using default value 7859
Last cylinder, +cylinders or +size{K,M,G} (7859-15665, default 15665):
Using default value 15665
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 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: 0x0006e97b
Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          26      204800  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        7859    62914560  8e  Linux LVM
/dev/sda4            7859      15665    62708728+  5  Extended

创建逻辑分区

Command (m for help): n
Command action
l  logical (5 or over)
p  primary partition (1-4)
l
First cylinder (7859-15665, default 7859):
Using default value 7859
Last cylinder, +cylinders or +size{K,M,G} (7859-15665, default 15665): +20G
Command (m for help): P
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 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: 0x0006e97b
Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          26      204800  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        7859    62914560  8e  Linux LVM
/dev/sda4            7859      15665    62708728+  5  Extended
/dev/sda5            7859      10470    20979859+  83  Linux

格式化磁盘分区

[root@station110 ~]# mke2fs -b 1024 -m 3 -L music /dev/sda5

创建挂载点,进行挂载
[root@station110 ~]# mkdir /media/music
[root@station110 ~]# mount /dev/sda5 /media/music

取消挂载

[root@station110 ~]# umount /dev/sda5

只读挂载
[root@station110 ~]# mount -o ro /dev/sda6 /media/book
[root@station110 ~]# mount -r /dev/sda6 /media/book

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/19424.html