Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6545559
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: LINUX

2011-11-23 10:29:16

新加入的硬盘格式化
步骤1:
  1. [root@rac1 ~]# fdisk /dev/sdb
  2. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
  3. Building a new DOS disklabel. Changes will remain in memory only,
  4. until you decide to write them. After that, of course, the previous
  5. content won't be recoverable.
  6. The number of cylinders for this disk is set to 1305.
  7. There is nothing wrong with that, but this is larger than 1024,
  8. and could in certain setups cause problems with:
  9. 1) software that runs at boot time (e.g., old versions of LILO)
  10. 2) booting and partitioning software from other OSs
  11. (e.g., DOS FDISK, OS/2 FDISK)
  12. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
  13. Command (m for help): m
  14. Command action
  15. a toggle a bootable flag
  16. b edit bsd disklabel
  17. c toggle the dos compatibility flag
  18. d delete a partition
  19. l list known partition types
  20. m print this menu
  21. n add a new partition
  22. o create a new empty DOS partition table
  23. p print the partition table
  24. q quit without saving changes
  25. s create a new empty Sun disklabel
  26. t change a partition's system id
  27. u change display/entry units
  28. v verify the partition table
  29. w write table to disk and exit
  30. x extra functionality (experts only)
 步骤2:
  1. Command (m for help): n
  2. Command action
  3. e extended
  4. p primary partition (1-4)
  5. p
  6. Partition number (1-4): 1
  7. First cylinder (1-1305, default 1):
  8. Using default value 1
  9. Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
  10. Using default value 1305
  11. Command (m for help): w
  12. The partition table has been altered!
  13. Calling ioctl() to re-read partition table.
  14. Syncing disks.
步骤3:
  1. [root@rac1 ~]# fdisk -l
  2. Disk /dev/sda: 10.7 GB, 10737418240 bytes
  3. 255 heads, 63 sectors/track, 1305 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5. Device Boot Start End Blocks Id System
  6. /dev/sda1 * 1 1147 9213246 83 Linux
  7. /dev/sda2 1148 1305 1269135 82 Linux swap
  8. Disk /dev/sdb: 10.7 GB, 10737418240 bytes
  9. 255 heads, 63 sectors/track, 1305 cylinders
  10. Units = cylinders of 16065 * 512 = 8225280 bytes
  11. Device Boot Start End Blocks Id System
  12. /dev/sdb1 1 1305 10482381 5 Extended

步骤4 格式化分区

  1. [root@rac1 ~]# mkfs -t ext3 -c /dev/sdb1
  2. mke2fs 1.35 (28-Feb-2004)
  3. Filesystem label=
  4. OS type: Linux
  5. Block size=4096 (log=2)
  6. Fragment size=4096 (log=2)
  7. 1310720 inodes, 2620595 blocks
  8. 131029 blocks (5.00%) reserved for the super user
  9. First data block=0
  10. Maximum filesystem blocks=2684354560
  11. 80 block groups
  12. 32768 blocks per group, 32768 fragments per group
  13. 16384 inodes per group
  14. Superblock backups stored on blocks:
  15. 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
  16. Checking for bad blocks (read-only test): done
  17. Writing inode tables: done
  18. Creating journal (8192 blocks): done
  19. Writing superblocks and filesystem accounting information: done
  20. This filesystem will be automatically checked every 25 mounts or
  21. 180 days, whichever comes first. Use tune2fs -c or -i to override.

步骤5:创建目录然后将该分区加挂到该目录下

  1. [root@rac1 /]# mkdir /u01
  2. [root@rac1 /]# mount /dev/sdb1 /u01

步骤6:修改/etc/fstab文件添加如下记录使系统每次重启后都能自动加载该分区

步骤7:

[root@rac1 /]#vi /etc/fstab
在文件的末尾填加如下内容

/dev/sdb1   /u01  ext3  defaults 1 2

说明:

若新加硬盘的时候选择了创建逻辑盘(即选择了e)的时候,格式话的时候会报如下错误:

mkfs -t ext3 -c /dev/sdb1
Invalid argument passed to ext2 library while setting up superblock.

这是因为我们这里只创建了逻辑盘,没有创建逻辑分区,所以创建完逻辑盘后还需要创建逻辑分区:

[root@hxl oracle]# fdisk /dev/sdb

The number of cylinders for this disk is set to 2088.
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): 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 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): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (1-2088, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2088, default 2088):
Using default value 2088

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@hxl oracle]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1000     8032468+  83  Linux
/dev/sda2            1001        1200     1606500   82  Linux swap / Solaris
/dev/sda3            1201        2610    11325825   83  Linux

Disk /dev/sdb: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2088    16771828+   5  Extended
/dev/sdb5               1        2088    16771797   83  Linux
[root@hxl oracle]# mkfs -t ext3 -c /dev/sdb5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2097152 inodes, 4192949 blocks
209647 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
128 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

Checking for bad blocks (read-only test): done                               
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@hxl oracle]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1000     8032468+  83  Linux
/dev/sda2            1001        1200     1606500   82  Linux swap / Solaris
/dev/sda3            1201        2610    11325825   83  Linux

Disk /dev/sdb: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2088    16771828+   5  Extended
/dev/sdb5               1        2088    16771797   83  Linux

阅读(4013) | 评论(0) | 转发(0) |
0

上一篇:如何配置telnet

下一篇:开启vsftpd服务

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