一、问题描述
解决centos系统报"磁盘格式化驱动器出错"An error occurred while performing an operation on 1.0TB 硬盘(ATA WDC WD10EZEX-08WN4A0):设备忙..One or more partitions are busy on /dev/sda...mount: unknown filesystem type 'LVM2_member'"错误(如下图)
二、解决方法
1、查看磁盘状态,从而知道磁盘分区位置/dev/sda2相关信息
[root@centos6 ~]# mount | column -t@b@/dev/mapper/vg_centos6-lv_root on / type ext4 (rw)@b@proc on /proc type proc (rw)@b@sysfs on /sys type sysfs (rw)@b@devpts on /dev/pts type devpts (rw,gid=5,mode=620)@b@tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")@b@/dev/sda1 on /boot type ext4 (rw)@b@/dev/mapper/vg_centos6-lv_home on /home type ext4 (rw)@b@none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)@b@sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)@b@nfsd on /proc/fs/nfsd type nfsd (rw)@b@gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
[root@centos6 ~]# cat /proc/partitions@b@major minor #blocks name@b@@b@ 8 16 838860800 sdb@b@ 8 0 524288000 sda@b@ 8 1 512000 sda1@b@ 8 2 523774976 sda2@b@ 253 0 52428800 dm-0@b@ 253 1 3031040 dm-1@b@ 253 2 468312064 dm-2
[root@centos6 ~]# fdisk -l |grep Disk@b@Disk /dev/sdb: 859.0 GB, 858993459200 bytes@b@Disk identifier: 0x00000000@b@Disk /dev/sda: 536.9 GB, 536870912000 bytes@b@Disk identifier: 0x000b5306@b@Disk /dev/mapper/vg_centos6-lv_root: 53.7 GB, 53687091200 bytes@b@Disk identifier: 0x00000000@b@Disk /dev/mapper/vg_centos6-lv_swap: 3103 MB, 3103784960 bytes@b@Disk identifier: 0x00000000@b@Disk /dev/mapper/vg_centos6-lv_home: 479.6 GB, 479551553536 bytes@b@Disk identifier: 0x00000000
2、将需扩展的/dev/sda2磁盘分区进行ext4格式化
[root@raid2t data210202]# mkfs -t ext4 -c /dev/sda2@b@mke2fs 1.41.12 (17-May-2010)@b@/dev/sda2 is apparently in use by the system; will not make a 文件系统 here!@b@[root@raid2t data210202]# dmsetup status@b@vg_raid2t-lv_home: 0 2719547392 linear @b@vg_s3-lv_home: 0 1831510016 linear @b@vg_raid2t-lv_swap: 0 57081856 linear @b@vg_raid2t-lv_root: 0 1128857600 linear @b@docker-253:2-82444291-pool: 0 209715200 thin-pool 69 691/524288 22105/1638400 - rw discard_passdown queue_if_no_space - @b@vg_s3-lv_swap: 0 16121856 linear @b@vg_s3-lv_root: 0 104857600 linear @b@[root@raid2t data210202]# dmsetup remove_all@b@[root@raid2t data210202]# dmsetup status@b@vg_raid2t-lv_home: 0 2719547392 linear @b@vg_raid2t-lv_swap: 0 57081856 linear @b@vg_raid2t-lv_root: 0 1128857600 linear @b@[root@raid2t data210202]# mke2fs -t ext4 /dev/sda2@b@mke2fs 1.41.12 (17-May-2010)@b@文件系统标签=@b@操作系统:Linux@b@块大小=4096 (log=2)@b@分块大小=4096 (log=2)@b@Stride=1 blocks, Stripe width=0 blocks@b@61022208 inodes, 244062208 blocks@b@12203110 blocks (5.00%) reserved for the super user@b@第一个数据块=0@b@Maximum filesystem blocks=4294967296@b@7449 block groups@b@32768 blocks per group, 32768 fragments per group@b@8192 inodes per group@b@Superblock backups stored on blocks: @b@ 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, @b@ 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, @b@ 102400000, 214990848@b@@b@正在写入inode表: 完成 @b@Creating journal (32768 blocks): 完成@b@Writing superblocks and filesystem accounting information: @b@完成@b@@b@This filesystem will be automatically checked every 28 mounts or@b@180 days, whichever comes first. Use tune2fs -c or -i to override.
3、创建磁盘分区扩展点挂载目录路径 - 将磁盘/dev/sda2挂载到data210202目录(解挂umount /dev/sda1)
[root@raid2t data210202]# cd /@b@[root@raid2t data210202]# mkdir data210202@b@ @b@[root@raid2t data210202]# mount /dev/sda2 /data210202@b@@b@[root@raid2t data210202]# df -lh@b@Filesystem Size Used Avail Use% Mounted on@b@...@b@/dev/sda2 917G 72M 870G 1% /data210202
4、让系统开机自动挂载这块硬盘
[root@raid2t data210202]# vi /etc/fstab@b@#@b@# /etc/fstab@b@# Created by anaconda on Wed Aug 8 23:39:30 2018@b@#@b@# Accessible filesystems, by reference, are maintained under '/dev/disk'@b@# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info@b@#@b@...@b@/dev/sda2 /data210202 ext4 defaults 0 0