新增硬盘扩容Linux下的分区大小



     

主题

新增硬盘扩容Linux下的分区大小

关键词

Linux分区 调整大小

操作环境

VMWare7.0+RHEL5

问题分析

在目录大小不足的情况下在线对其进行扩容

一、首先是在关机的环境下点击虚拟机的属性,对其添加一块硬盘

 

二、查看硬盘状态

[root@localhost~]# fdisk -l

Disk /dev/sda:21.4 GB, 21474836480 bytes

255 heads, 63sectors/track, 2610 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks  Id  System

/dev/sda1   *          1          13      104391  83  Linux

/dev/sda2              14        2610   20860402+  8e  Linux LVM

 

Disk /dev/sdb:21.4 GB, 21474836480 bytes

255 heads, 63sectors/track, 2610 cylinders

Units =cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdbdoesn't contain a valid partition table//显示找到一个盘sdb,但是没有有效的分区表

 

三、查看新盘的信息

[root@localhost~]# df /dev/sdb

Filesystem           1K-blocks      Used Available Use% Mounted on

-                       257604       100   257504   1% /dev

 

四、对新盘进行分区

[root@localhost~]# fdisk /dev/sdb

Device containsneither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a newDOS disklabel. Changes will remain in memory only,

until youdecide to write them. After that, of course, the previous

content won'tbe recoverable.

The number ofcylinders for this disk is set to 2610.

There isnothing wrong with that, but this is larger than 1024,

and could incertain setups cause problems with:

1) softwarethat runs at boot time (e.g., old versions of LILO)

2) booting andpartitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Warning:invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m forhelp): n//创建一个新的逻辑磁盘

Command action

   e  extended//扩展分区

   p  primary partition (1-4)

p//主分区

Partitionnumber (1-4): 1//相当于盘符

First cylinder(1-2610, default 1): 1//第一柱头

Last cylinderor +size or +sizeM or +sizeK (1-2610, default 2610): 2610//最后的柱头

Command (m forhelp): t//选择分区类型

Selectedpartition 1

Hex code (typeL to list codes): 83//83是Linux类型,,具体类型可以在l下面看到

Command (m forhelp): w//写入分区表

The partitiontable has been altered!

 

Calling ioctl()to re-read partition table.

Syncing disks.

//下面是格式化分区为ext3格式

[root@localhost~]# mkfs.ext3 /dev/sdb1

mke2fs 1.39(29-May-2006)

Filesystemlabel=

OS type: Linux

Block size=4096(log=2)

Fragmentsize=4096 (log=2)

2621440 inodes,5241198 blocks

262059 blocks(5.00%) reserved for the super user

First datablock=0

Maximumfilesystem blocks=0

160 blockgroups

32768 blocksper group, 32768 fragments per group

16384 inodesper group

Superblockbackups stored on blocks:

        32768, 98304, 163840, 229376, 294912,819200, 884736, 1605632, 2654208,

        4096000

 

Writing inodetables: done                           

Creatingjournal (32768 blocks): done

Writingsuperblocks and filesystem accounting information: done

 

This filesystemwill be automatically checked every 37 mounts or

180 days,whichever comes first.  Use tune2fs -c or-i to override.

  • 1
  • 2
  • 3
  • 下一页

相关内容