您的位置:首页 > 其它

阿里云数据盘挂载遇到的一些问题总结

2017-02-23 14:57 399 查看
在上一篇文章《阿里云数据盘/硬盘挂载流程(CentOS)》中提到了阿里云主机挂载的基本流程,但在挂载的过程中也遇到一些奇葩的问题!

1、首先看一下系统信息:

[root@iZ28afd0manZ /]# fdisk -l

Disk /dev/xvda: 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: 0x00073f45

Device Boot Start End Blocks Id System
/dev/xvda1 * 1 2611 20970496 83 Linux

Disk /dev/xvdb (Sun disk label): 255 heads, 63 sectors, 65270 cylinders
Units = cylinders of 16065 * 512 bytes

Device Flag Start End Blocks Id System
/dev/xvdb1 0 65264 524233080 83 Linux native
/dev/xvdb2 u 65264 65270 48195 82 Linux swap
/dev/xvdb3 0 65270 524281275 5 Whole disk2、格式化数据盘/dev/xvdb
[root@iZ28afd0manZ /]# mkfs.ext3 /dev/xvdb
mke2fs 1.41.12 (17-May-2010)
/dev/xvdb is mounted; will not make a filesystem here!
[root@iZ28afd0manZ /]# mkfs.ext3 /dev/xvdb1
mke2fs 1.41.12 (17-May-2010)
/dev/xvdb1 is apparently in use by the system; will not make a filesystem here!3、提示/dev/xvdb已经挂载,/dev/xvdb1已经在使用中,都不允许格式化,参考https://zhidao.baidu.com/question/81665433.html的提示,需要先清除挂载才能继续格式化;
4、清除挂载1分区

[root@iZ28afd0manZ /]# fdisk -l

Disk /dev/xvda: 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: 0x00073f45

Device Boot Start End Blocks Id System
/dev/xvda1 * 1 2611 20970496 83 Linux

Disk /dev/xvdb (Sun disk label): 255 heads, 63 sectors, 65270 cylinders
Units = cylinders of 16065 * 512 bytes

Device Flag Start End Blocks Id System
/dev/xvdb1 0 65264 524233080 83 Linux native
/dev/xvdb2 u 65264 65270 48195 82 Linux swap
/dev/xvdb3 0 65270 524281275 5 Whole disk

准备清除分区/dev/xvdb1
[root@iZ28afd0manZ /]# fdisk /dev/xvdb

Command (m for help): m
Command action
a toggle a read only flag
b edit bsd disklabel
c toggle the mountable 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)

Command (m for help): d
Partition number (1-8): 1

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: Invalid argument.
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@iZ28afd0manZ /]# fdisk -l

Disk /dev/xvda: 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: 0x00073f45

Device Boot Start End Blocks Id System
/dev/xvda1 * 1 2611 20970496 83 Linux

Disk /dev/xvdb (Sun disk label): 255 heads, 63 sectors, 65270 cylinders
Units = cylinders of 16065 * 512 bytes

Device Flag Start End Blocks Id System
/dev/xvdb2 u 65264 65270 48195 82 Linux swap
/dev/xvdb3 0 65270 524281275 5 Whole disk

5、至此,可看见/dev/xvdb1分区已经去除挂载,同理操作去除/dev/xvdb2和/dev/xvdb3;
6、最后得到如下情况:

[root@iZ28afd0manZ /]# fdisk -l

Disk /dev/xvda: 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: 0x00073f45

Device Boot Start End Blocks Id System
/dev/xvda1 * 1 2611 20970496 83 Linux

Disk /dev/xvdb (Sun disk label): 255 heads, 63 sectors, 65270 cylinders
Units = cylinders of 16065 * 512 bytes

Device Flag Start End Blocks Id System

7、再次格式化
[root@iZ28afd0manZ /]# mkfs.ext3 /dev/xvdb
mke2fs 1.41.12 (17-May-2010)
/dev/xvdb is mounted; will not make a filesystem here!
[root@iZ28afd0manZ /]# mkfs.ext3 /dev/xvdb1
mke2fs 1.41.12 (17-May-2010)
/dev/xvdb1 is apparently in use by the system; will not make a filesystem here!8、再次对/dev/xvdb进行解除挂载
[root@iZ28afd0manZ dev]# umount /dev/xvdb
umount: /dev/xvdb: not mounted9、至此,没有任何办法。重启吧。。。。。
[root@iZ28afd0manZ dev]# reboot10.再次查看,居然奇迹般的好了,果然是万能的重启啊!
[root@iZ28afd0manZ ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 20641404 8464512 11128368 44% /
tmpfs 8165556 0 8165556 0% /dev/shm
/dev/xvdb 516061624 202652 489644572 1% /mnt

整个过程就是不断的试,最后稀里糊涂的好了,以此为记!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息