加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

linux格式化扩展分区报错解决

(2017-03-24 16:32:47)
标签:

格式化扩展分区

格式化出错

linux磁盘格式化报错

分类: linux系统运维

Linux格式化扩展分区时会报错,因为Linux扩展分区格式化无意义,它是为logical partition服务的,它们大小一样。在一块硬盘里你最多只能创造four partiton,包括主分区与expand分区,而一个expand分区可以创造去多个logical partition,是在logical partition使用space的。此时,为了解决问题,可以在扩展分区上创建主分区(p)或逻辑分区(l


以下演示出错解决过程:

1、创建扩展分区

[root@localhost tmp]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').


Command (m for help): n

First cylinder (4106-4178, default 4106):

Using default value 4106

Last cylinder, +cylinders or +size{K,M,G} (4106-4178, default 4178): +100M


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 or after you run partprobe(8) or kpartx(8)

Syncing disks.

[root@localhost tmp]# fdisk -l


Disk /dev/sda: 34.4 GB, 34359738368 bytes

255 heads, 63 sectors/track, 4177 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: 0x0003d455


Device Boot Start End Blocks Id System

/dev/sda1 * 1 128 1024000 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 128 2040 15360000 83 Linux

/dev/sda3 2040 3825 14336000 83 Linux

/dev/sda4 3825 4178 2833408 5 Extended

/dev/sda5 3825 4106 2252800 82 Linux swap / Solaris

/dev/sda6 4106 4119 109964 83 Linux


2、格式化磁盘分区

[root@localhost ~]# mount /dev/sda6 /data

mount: you must specify the filesystem type

显示分区未格式化

[root@localhost ~]# mkfs -t ext3 -c /dev/sda6

mke2fs 1.41.12 (17-May-2010)

mkfs.ext3: inode_size (128) * inodes_count (0) too big for a

filesystem with 0 blocks, specify higher inode_ratio (-i)

or lower inode count (-N).


3、格式化扩展分区报错解决

格式磁盘时发现如下错误,原因是扩展分区无法格式化,

解决方法是在扩展分区上创建主分区(p)或逻辑分区(l

[root@localhost ~]# fdisk /dev/sda6

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0xcbd45cde.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.


Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').


Command (m for help): p


Disk /dev/sda6: 112 MB, 112603136 bytes

255 heads, 63 sectors/track, 13 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: 0xcbd45cde


Device Boot Start End Blocks Id System


Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-13, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-13, default 13): 13M


Command (m for help): P


Disk /dev/sda6: 112 MB, 112603136 bytes

255 heads, 63 sectors/track, 13 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: 0xcbd45cde


Device Boot Start End Blocks Id System

/dev/sda6p1 1 13 104391 83 Linux


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 22: 无效的参数.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

此处要重启使生效,也可以使用partprobe命令

[root@localhost ~]# partprobe

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (设备或资源忙). As a result, it may not reflect all of your changes until after reboot.

Warning: 无法以读写方式打开 /dev/sr0 (只读文件系统)/dev/sr0 已按照只读方式打开。

Warning: 无法以读写方式打开 /dev/sr0 (只读文件系统)/dev/sr0 已按照只读方式打开。

Error: 无效的分区表 - /dev/sr0 出现递归分区。

[root@localhost ~]# fdisk -l

Disk /dev/sda: 34.4 GB, 34359738368 bytes

255 heads, 63 sectors/track, 4177 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: 0x0003d455


Device Boot Start End Blocks Id System

/dev/sda1 * 1 128 1024000 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 128 2040 15360000 83 Linux

/dev/sda3 2040 3825 14336000 83 Linux

/dev/sda4 3825 4178 2833408 5 Extended

/dev/sda5 3825 4106 2252800 82 Linux swap / Solaris

/dev/sda6 4106 4119 109964 83 Linux

[root@localhost ~]# mkdir /data

再次格式化,显示格式化成功。

[root@localhost ~]# mkfs.ext3 /dev/sda6

mke2fs 1.41.12 (17-May-2010)

文件系统标签=

操作系统:Linux

块大小=1024 (log=0)

分块大小=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

27552 inodes, 109964 blocks

5498 blocks (5.00%) reserved for the super user

第一个数据块=1

Maximum filesystem blocks=67371008

14 block groups

8192 blocks per group, 8192 fragments per group

1968 inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345, 73729


正在写入inode: 完成

Creating journal (4096 blocks): 完成

Writing superblocks and filesystem accounting information: 完成


This filesystem will be automatically checked every 24 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.


4、再次挂载磁盘分区,挂载成功

[root@localhost ~]# mount /dev/sda6 /data

[root@localhost ~]# df -hT

[root@localhost /]# df -hT

Filesystem Type Size Used Avail Use% Mounted on

/dev/sda2 ext4 15G 8.4G 5.9G 59% /

/dev/sda1 ext4 969M 54M 865M 6% /boot

/dev/sda3 ext4 14G 525M 13G 5% /home

/dev/sr0 iso9660 1.8G 1.8G 0 100% /mnt/iso

share vboxsf 222G 93G 129G 42% /mnt/share

/dev/sda6 ext3 104M 5.7M 93M 6% /data

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有