Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3335371
  • 博文数量: 815
  • 博客积分: 12898
  • 博客等级: 上将
  • 技术积分: 7883
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-25 09:57
文章分类

全部博文(815)

文章存档

2014年(1)

2011年(46)

2010年(192)

2009年(121)

2008年(70)

2007年(385)

分类: LINUX

2007-10-06 13:07:20

这里一添加一块120G磁盘为例:
1.建立分区表:

# fdisk /dev/hdb


The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p   //查看当前分区状况

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n   //新建分区
Command action
   e   extended
   p   primary partition (1-4)
p                     //指定建立主分区
Partition number (1-4):   //指定建立的分区号
First cylinder (1-14593, default 1): [Enter]//指定分区的起始柱面(这里采用默认值)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-14593, default 14593): 7000   //指定分区的结束柱面

Command (m for help): p   //查看当前分区状况

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1        7000    56227468+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (7001-14593, default 7001): [Enter]//指定分区的起始柱面(这里采用默认值)
Using default value 7001
Last cylinder or +size or +sizeM or +sizeK (7001-14593, default 14593): [Enter]//指定分区的结束柱面(这里采用默认值)
Using default value 14593

Command (m for help): p

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1        7000    56227468+  83  Linux
/dev/hdb2            7001       14593    60990772+  83  Linux

Command (m for help): w      //保存刚才的分区设置,如果不想保存可以直接键入"q"退出
The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

# fdisk -l   //查看当前磁盘的分区情况

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1305    10482381    7  HPFS/NTFS
/dev/hda2            1306        4361    24547320   83  Linux
/dev/hda3            4493        9729    42066202+   f  W95 Ext'd (LBA)
/dev/hda4            4362        4492     1052257+  82  Linux swap / Solaris
/dev/hda5            4493        9729    42066171    7  HPFS/NTFS

Partition table entries are not in disk order

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1        7000    56227468+  83  Linux
/dev/hdb2            7001       14593    60990772+  83  Linux
#

2.格式化分区
# fsck.ext3 /dev/hdb1
e2fsck 1.39 (29-May-2006)
Resize inode not valid.  Recreate? yes

/ was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  +(786432--787450) -790513
Fix? yes

Free blocks count wrong for group #0 (65535, counted=0).
Fix? yes

Free blocks count wrong (2853857, counted=2853858).
Fix? yes


/: ***** FILE SYSTEM WAS MODIFIED *****
/: 154156/3840192 files (0.3% non-contiguous), 985669/3839527 blocks




格式化分区出现错误,LINUX中也是只能分为4个主分区
重新建立分区系统
# fdisk /dev/hdb

The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d   //删除分区
Partition number (1-4): 1   //指定删除分区的节点号

Command (m for help): p

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb2            7001       14593    60990772+  83  Linux


Command (m for help): help   //查看帮助信息
h: unknown command
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 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)

Command (m for help):
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
  //建立扩展分区
Partition number (1-4): 1
First cylinder (1-14593, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-14593, default 14593):
Using default value 14593

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l   //建立逻辑分区
First cylinder (7001-14593, default 7001):
Using default value 7001
Last cylinder or +size or +sizeM or +sizeK (7001-14593, default 14593):
Using default value 14593
......

Command (m for help): p

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1       14593   117218241    5  Extended
/dev/hdb5               1        7000    56227437   83  Linux
/dev/hdb6            7001       14593    60990741   83  Linux

再次格式划
# mke2fs /dev/hdb5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
7028736 inodes, 14056859 blocks
702842 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
429 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424

Writing inode tables: done                           
Writing superblocks and filesystem accounting information:
done

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

# mke2fs /dev/hdb6
......


# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1305    10482381    7  HPFS/NTFS
/dev/hda2            1306        4361    24547320   83  Linux
/dev/hda3            4493        9729    42066202+   f  W95 Ext'd (LBA)
/dev/hda4            4362        4492     1052257+  82  Linux swap / Solaris
/dev/hda5            4493        9729    42066171    7  HPFS/NTFS

Partition table entries are not in disk order

Disk /dev/hdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1       14593   117218241    5  Extended
/dev/hdb5               1        7000    56227437   83  Linux
/dev/hdb6            7001       14593    60990741   83  Linux

3.挂载文件系统
# mount /dev/hdb5 /mnt/      //挂载文件系统
# df -h
文件系统              容量  已用 可用 已用% 挂载点
/dev/hda2              23G  3.1G   19G  15% /
tmpfs                 233M     0  233M   0% /dev/shm
/dev/hdb5              53G   52M   51G   1% /mnt

固化挂接
#vi /etc/fstab
添加:
/dev/hdb5    /data                            ext3    defaults        1 1
/dev/hdb6    /backup                        ext3    defaults        1 1



阅读(2782) | 评论(1) | 转发(0) |
0

上一篇:LDAP笔记二

下一篇:VMware 6.0 for linux

给主人留下些什么吧!~~