linux下fdis格式化磁盘(维护日志)

2012年1月10日维护日志

服务器磁盘未分区格式化的处理。

[root@yzradius ~]# fdisk -l

Disk /dev/sda: 143.9 GB, 143998844928 bytes
255 heads, 63 sectors/track, 17506 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1305    10482381   83  Linux
/dev/sda2            1306        1827     4192965   82  Linux swap / Solaris
/dev/sda4           10787       17506    53978400    5  Extended

[root@yzradius ~]# fdisk /dev/sda

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

Command (m for help): p

Disk /dev/sda: 143.9 GB, 143998844928 bytes
255 heads, 63 sectors/track, 17506 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1305    10482381   83  Linux
/dev/sda2            1306        1827     4192965   82  Linux swap / Solaris
/dev/sda3            1828       10786    71963167+  83  Linux
/dev/sda4           10787       17506    53978400    5  Extended

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

[root@yzradius ~]# df
文件系统               1K-块        已用     可用 已用% 挂载点
/dev/sda1             10153988   8552776   1077096  89% /
tmpfs                  2069716         0   2069716   0% /dev/shm

[root@yzradius ~]# fdisk -l

Disk /dev/sda: 143.9 GB, 143998844928 bytes
255 heads, 63 sectors/track, 17506 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1305    10482381   83  Linux
/dev/sda2            1306        1827     4192965   82  Linux swap / Solaris
/dev/sda3            1828       10786    71963167+  83  Linux
/dev/sda4           10787       17506    53978400    5  Extended

[root@yzradius ~]# mkfs.ext3 /dev/sda3
mke2fs 1.39 (29-May-2006)
Could not stat /dev/sda3 --- 没有那个文件或目录

The device apparently does not exist; did you specify it correctly?

[root@yzradius ~]# rpm -q parted
parted-1.8.1-27.el5

[root@yzradius ~]# partprobe

[root@yzradius ~]# mkfs -t ext3 /dev/sda3
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
9011200 inodes, 17990791 blocks
899539 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
550 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                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

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

[root@yzradius ~]# mkdir /data

[root@yzradius ~]# mount /dev/sda3 /data

[root@yzradius ~]# df -lh
文件系统              容量  已用 可用 已用% 挂载点
/dev/sda1             9.7G  8.2G  1.1G  89% /
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/sda3              68G  180M   64G   1% /data

猜你喜欢

转载自zlbabel.iteye.com/blog/1341525
今日推荐