Chinaunix首页 | 论坛 | 博客
  • 博客访问: 794918
  • 博文数量: 106
  • 博客积分: 1250
  • 博客等级: 少尉
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-09 09:38
文章分类

全部博文(106)

文章存档

2014年(1)

2013年(13)

2012年(92)

分类:

2012-10-17 21:40:42

在机器添加了新的硬盘之后,需要对其进行分区、创建文件系统并挂载之后,才能使用。具体步骤如下

1、使用fdisk命令给硬盘分区

点击(此处)折叠或打开

  1. # fdisk /dev/sdb
  2. Command (m for help): p

  3. Disk /dev/sdb: 21.4 GB, 21474836480 bytes
  4. 255 heads, 63 sectors/track, 2610 cylinders
  5. Units = cylinders of 16065 * 512 = 8225280 bytes

  6.    Device Boot Start End Blocks Id System

  7. Command (m for help): n
  8. Command action
  9.    e extended
  10.    p primary partition (1-4)
  11. p
  12. Partition number (1-4): 1
  13. First cylinder (1-2610, default 1):
  14. Using default value 1
  15. Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
  16. Using default value 2610

  17. Command (m for help): w ----将改动写入磁盘
  18. The partition table has been

不通类型的硬盘的标识有一定的区别,通过fdisk -l 命令:

Disk Type Device Name Format Description
IDE disk
/dev/hdxn 
In this example, x is a letter that identifies the IDE disk, and n is the partition number. For example, /dev/hda is the first disk on the first IDE bus.
SCSI disk
/dev/sdxn 
In this example, x is a letter that identifies the SCSI disk, and n is the partition number. For example, /dev/sda is the first disk on the first SCSI bus.
RAID disk
/dev/rd/cxdypz /dev/ida/cxdypz 
Depending on the RAID controller, RAID devices can have different device names. In the examples shown, x is a number that identifies the controller, y is a number that identifies the disk, and z is a number that identifies the partition. For example, /dev/ida/c0d1 is the second logical drive on the first controller.


2、使用mkfs格式化硬盘

点击(此处)折叠或打开

  1. # fdisk -l /dev/sdb

  2. Disk /dev/sdb: 21.4 GB, 21474836480 bytes
  3. 255 heads, 63 sectors/track, 2610 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes

  5.    Device Boot Start End Blocks Id System
  6. /dev/sdb1 1 2610 20964793+ 83 Linux

  7. perl-219-sles10:~ # mkfs -t ext3 /dev/sdb1
  8. ...
  9. Writing inode tables: done
  10. Creating journal (32768 blocks): done
  11. Writing superblocks and filesystem accounting information: ----直接回车

3、挂载

mount /dev/sdb1 /newfs

4、配置开机自动挂载

编辑/etc/fstab 文件
添加:/dev/sdb1 /newfs ext3 defaults 1 1
阅读(6194) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~