手工格式化硬盘
# fdisk /dev/sda //进入分割硬盘模式
The number of cylinders for this disk is set to 19457.
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 //删除一个分区
Selected partition 1
Command (m for help): w //写入磁盘退出分区程序,按w这个分区就等于是删除了
The partition table has been altered!
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy
重 启
# fdisk /dev/sda
The number of cylinders for this disk is set to 19457.
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): n //添加一个新分区
Command action
e extended
p primary partition (1-4)
P //显示分区表
Partition number (1-4): 1
First cylinder (1-19457, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457):
Using default value 19457
Command (m for help): w //按下w 保存退出皆可,分区工作结束 The partition table has been altered!
Calling ioctl() to re-read partition table
# umount /mnt/usb1 //卸载文件系统,/mnt/usb1是磁盘挂载目录
# mkfs.ext3 /dev/sda1 //格式化,其中/dev/sda1是硬盘分区名,而不是硬盘设备名 mke2fs 1.41.5 (23-Apr-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9773056 inodes, 39072080 blocks
1953604 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1193 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, 4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
重 启动
fdisk -l /dev/sda ,观察硬盘之实体使用情形,可以查看磁盘格式化情况
附录:
按m是显示命令帮助
出现如下界面
Command action
a toggle a bootable flag 设置引导扇区
b edit bsd disklabel 编辑卷标(linux下使用的卷标bsd通用)
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)
手工格式化硬盘
# fdisk /dev/sda //进入分割硬盘模式
The number of cylinders for this disk is set to 19457.
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 //删除一个分区
Selected partition 1
Command (m for help): w //写入磁盘退出分区程序,按w这个分区就等于是删除了
The partition table has been altered!
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy
重 启
# fdisk /dev/sda
The number of cylinders for this disk is set to 19457.
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): n //添加一个新分区
Command action
e extended
p primary partition (1-4)
P //显示分区表
Partition number (1-4): 1
First cylinder (1-19457, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457):
Using default value 19457
Command (m for help): w //按下w 保存退出皆可,分区工作结束 The partition table has been altered!
Calling ioctl() to re-read partition table
# umount /mnt/usb1 //卸载文件系统,/mnt/usb1是磁盘挂载目录
# mkfs.ext3 /dev/sda1 //格式化,其中/dev/sda1是硬盘分区名,而不是硬盘设备名 mke2fs 1.41.5 (23-Apr-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9773056 inodes, 39072080 blocks
1953604 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1193 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, 4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#
重 启动
fdisk -l /dev/sda ,观察硬盘之实体使用情形,可以查看磁盘格式化情况
附录:
按m是显示命令帮助
出现如下界面
Command action
a toggle a bootable flag 设置引导扇区
b edit bsd disklabel 编辑卷标(linux下使用的卷标bsd通用)
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)