Carey【胭脂扣】

RHEL6.4记录一次添加一块新分区的操作

首先看了下挂载点及目录 fdisk /dev/sda

 1 [root@box ~]# fdisk /dev/sda
 2 
 3 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
 4          switch off the mode (command 'c') and change display units to
 5          sectors (command 'u').
 6 
 7 Command (m for help): p
 8 
 9 Disk /dev/sda: 160.0 GB, 160041885696 bytes
10 255 heads, 63 sectors/track, 19457 cylinders
11 Units = cylinders of 16065 * 512 = 8225280 bytes
12 Sector size (logical/physical): 512 bytes / 512 bytes
13 I/O size (minimum/optimal): 512 bytes / 512 bytes
14 Disk identifier: 0xf0b1ebb0
15 
16    Device Boot      Start         End      Blocks   Id  System
17 /dev/sda1   *           1          52      409600   83  Linux
18 Partition 1 does not end on cylinder boundary.
19 /dev/sda2              52        2601    20480000   83  Linux
20 /dev/sda3            2601        5151    20480000   83  Linux
21 /dev/sda4            5151       19458   114919424    5  Extended
22 /dev/sda5            5151        6936    14336000   83  Linux
23 /dev/sda6            6936        8466    12288000   83  Linux
24 /dev/sda7            8466        9996    12288000   83  Linux
25 /dev/sda8            9996       11271    10240000   83  Linux
26 /dev/sda9           11271       11781     4096000   82  Linux swap / Solaris

这里看到我的主分区分区已经用完,下面有创建扩展分区,所以可以在下面新加一个逻辑分区 /dev/sda10

操作:

 1 Command (m for help): n           ##n为创建分区选项,这里无法在创建主分区所以可以省略询问sda* *为数的选项
 2 First cylinder (11801-19458, default 11801):              默认回车即可
 3 Using default value 11801
 4 Last cylinder, +cylinders or +size{K,M,G} (11801-19458, default 19458): +150M    这里我创建一个150M的逻辑分区 回车
 5 
 6 Command (m for help): p   好创建完成 p 查看下现在的分区情况 | 然后q 回车退出fdisk 模式
 7 
 8 Disk /dev/sda: 160.0 GB, 160041885696 bytes
 9 255 heads, 63 sectors/track, 19457 cylinders
10 Units = cylinders of 16065 * 512 = 8225280 bytes
11 Sector size (logical/physical): 512 bytes / 512 bytes
12 I/O size (minimum/optimal): 512 bytes / 512 bytes
13 Disk identifier: 0xf0b1ebb0
14 
15    Device Boot      Start         End      Blocks   Id  System
16 /dev/sda1   *           1          52      409600   83  Linux
17 Partition 1 does not end on cylinder boundary.
18 /dev/sda2              52        2601    20480000   83  Linux
19 /dev/sda3            2601        5151    20480000   83  Linux
20 /dev/sda4            5151       19458   114919424    5  Extended
21 /dev/sda5            5151        6936    14336000   83  Linux
22 /dev/sda6            6936        8466    12288000   83  Linux
23 /dev/sda7            8466        9996    12288000   83  Linux
24 /dev/sda8            9996       11271    10240000   83  Linux
25 /dev/sda9           11271       11781     4096000   82  Linux swap / Solaris
26 /dev/sda10          11781       11800      158700+  83  Linux

但我在运行  

#partprobe
时报错,提示内核未读
然后直接运行格式化命令
#mkfs -t ext4 /dev/sda10
报错。
根据partprobe 提示信息只好重新reboot重启下
然后再运行 格式化命令
#mkfs -t ext4 /dev/sda10
OK成功
然后mount /dev/sda10 /mnt 我将分区临时挂载到了/mnt下 是临时的 如果是永久的话可以 在/etc/fstab 下添加或者 当然这个是本人经常使用的,
将mount /dev/sda10 /mnt 这条命令写入到 启动项的配置文件里 /etc/rc.local 下 这样的好处是安全。因为不懂/etc/fstab这个文件的一些设置的
修改会使系统瘫痪的。
当然
新增分区的话用 partx -a /dev/sda
删除分区的花用partx -d --nr N /dev/sda
这两个是不用重新启动机器的。
posted @ 2013-06-25 10:16  胭脂筘  阅读(330)  评论(0编辑  收藏  举报