linux不能创建分区表,解决Linux中分区之后不能创建文件系统

1.使用fdisk成功创建主分区/dev/sdb1,查看/proc/partitions中的分区信息

[root@localhost ~]# cat /proc/partitions

major minor #blocks name

8 0 20971520 sda

8 1 512000 sda1

8 2 20458496 sda2

8 16 10485760 sdb

8 17 522081 sdb1

8 32 10485760 sdc

8 33 1060258 sdc1

8 34 1060290 sdc2

8 35 1060290 sdc3

8 36 1 sdc4

8 37 1060258 sdc5

253 0 18849792 dm-0

253 1 1605632 dm-1

253 2 1060258 dm-2

253 3 1060290 dm-3

253 4 1060290 dm-4

253 5 1 dm-5

253 6 1060258 dm-6

253 7 112423 dm-7

253 8 1 dm-8

253 9 522081 dm-9

2.使用mke2fs创建文件系统提示/dev/sdb1正在被系统使用

[root@localhost ~]# mke2fs -t ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

/dev/sdb1 is apparently in use by the system; will not make a filesystem here!

3.使用mount查看/dev/sdb1是否被挂载,发现/dev/sdb1并没有被挂载

[root@localhost ~]# mount

/dev/mapper/VolGroup-lv_root on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

4.使用dd命令发现磁盘读写正常

[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 10.7 GB, 10737418240 bytes

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

Device Boot Start End Blocks Id System

/dev/sdb1 1 65 522081 83 Linux

[root@localhost ~]# dd if=/dev/zero of=/dev/sdb bs=512 count=1

1+0 records in

1+0 records out

512 bytes (512 B) copied, 0.000116963 s, 4.4 MB/s

[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 10.7 GB, 10737418240 bytes

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

5.使用fuser查看/dev/sdb1磁盘被系统中那个进程使用,发现并没用进程使用该磁盘

[root@localhost ~]# fuser /dev/sdb1

[root@localhost ~]#

6.使用dmsetup status命令发现 /dev/sd1 正在被dm服务占用,所以我们创建文件系统时提示报错。我们手工的移除,就可以正常的创建文件系统

[root@localhost ~]# dmsetup status

VolGroup-lv_swap: 0 3211264 linear

VolGroup-lv_root: 0 37699584 linear

sdb2: 0 2 linear

sdb1: 0 224847 linear

sdc5: 0 2120517 linear

sdc4: 0 2 linear

sdc3: 0 2120580 linear

sdc2: 0 2120580 linear

sdc1: 0 2120517 linear

sdb5: 0 1044162 linear

7.手工的移除/dev/sdb的映射关系(取消占用),就可以正常的创建文件系统

[root@localhost ~]# dmsetup remove sdb1

[root@localhost ~]# dmsetup remove sdb2

[root@localhost ~]# dmsetup remove sdb5

[root@localhost ~]# dmsetup status

VolGroup-lv_swap: 0 3211264 linear

VolGroup-lv_root: 0 37699584 linear

sdc5: 0 2120517 linear

sdc4: 0 2 linear

sdc3: 0 2120580 linear

sdc2: 0 2120580 linear

sdc1: 0 2120517 linear

8.成功创建文件系统且类型为ext4

[root@localhost ~]# mke2fs -t ext4 /dev/sdb1

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

130560 inodes, 522080 blocks

26104 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=67633152

64 block groups

8192 blocks per group, 8192 fragments per group

2040 inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Writing inode tables: done

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or

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

[root@localhost ~]#

[root@localhost ~]# blkid /dev/sdb1

/dev/sdb1: UUID="7fe362b4-389b-40f8-91ed-07572abc350a" TYPE="ext4"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值