1、# fdisk -l
查看磁盘信息,如下:
2、# fdisk /dev/sda
硬盘分区
对分区使用ext4格式化 -c参数要先检测磁盘坏道,需要注意,有事会有如下异常:
4、# mount -t ext4 /dev/sda4 /usr/local 挂载新硬盘
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b2584
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 788 6016000 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 788 1045 2064384 82 Linux swap / Solaris
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
First cylinder (1-112401, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-182401, default 112401):
Using default value 112401
Command (m for help): w
The partition table has been altered!
3、# mkfs -t ext4 -c /dev/sda4
对分区使用ext4格式化 -c参数要先检测磁盘坏道,需要注意,有事会有如下异常:
The device apparently does not exist; did you specify it correctly?
有人说通过执行 partprobe 可解决,但是本人过尝试不行,reboot 之后再次格式化 ok !
[root@localhost ~]# mkfs -t ext4 -c /dev/sda4
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
786432 inodes, 3144054 blocks
157202 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3221225472
96 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
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 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
4、# mount -t ext4 /dev/sda4 /usr/local 挂载新硬盘
5、# vi /etc/fstab 加入一行:
/dev/sda4 /usr/local ext4 defaults 0 0