Linux 磁盘清理重新格式化挂载脚本:diskformat.sh
#!/bin/bash
for i in {1…8}
do
umount /data0$i
done
PIDARRAY=()
for i in a b c d e f g h
do
parted -s /dev/sd
i
m
k
l
a
b
e
l
g
p
t
p
a
r
t
e
d
−
s
/
d
e
v
/
s
d
i mklabel gpt parted -s /dev/sd
imklabelgptparted−s/dev/sdi mkpart primary 0% 100%
mkfs.ext4 -T largfile /dev/sdKaTeX parse error: Expected 'EOF', got '&' at position 6: i"1" &̲ PIDARRAY+…!“)
echo “sd$i"1” is formatting…,please wait!!!”
done
wait ${PIDARRAY[@]}
if [ $? -eq 0 ]; then
echo " disk has been formatted successful"
else
exit 110
fi
sed -i s/UUID/#UUID/g /etc/fstab
echo “/dev/sda1 /data01 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sdb1 /data02 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sdc1 /data03 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sdd1 /data04 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sde1 /data05 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sdf1 /data06 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sdg1 /data07 ext4 defaults 1 2” >> /etc/fstab
echo “/dev/sdh1 /data08 ext4 defaults 1 2” >> /etc/fstab
mount /dev/sda1 /data01
mount /dev/sdb1 /data02
mount /dev/sdc1 /data03
mount /dev/sdd1 /data04
mount /dev/sde1 /data05
mount /dev/sdf1 /data06
mount /dev/sdg1 /data07
mount /dev/sdh1 /data08
问题1:
解决:fuser -vm /data01 然后 kill -9 1151 47402
问题2:
解决方法:
dmsetup status
dmsetup remove_all
dmsetup remove 卷名
dmsetup remove vg03-data03
dmsetup remove vg01-data01
dmsetup remove vg08-data08
dmsetup remove vg06-data06
dmsetup remove vg04-data04
dmsetup remove vg02-data02
dmsetup remove vg07-data07
dmsetup remove vg05-data05
“dmsetup status” 是一个用于显示设备映射 (Device Mapper) 状态的命令。在Linux系统中,设备映射是一种用于创建逻辑卷管理(LVM)、软件RAID等功能的机制。