partx -d -nr /dev/sdb

余生长醉 提交于 2020-03-10 12:19:39

[root@centos6 ~]#mount --显示挂载的文件系统

/dev/sda2 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)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sda3 on /data type ext4 (rw)
/mnt/disk on /mnt/xdisk type ext4 (rw,loop=/dev/loop0)
/dev/sdb1 on /mnt/sdb1 type ext4 (rw) ---显示是挂载的
[root@centos6 ~]#umount /mnt/sdb1 ---取消挂载

[root@centos6 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 100M 0 loop /mnt/xdisk
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 97.7G 0 part /
├─sda3 8:3 0 48.8G 0 part /data
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 2G 0 part [SWAP]
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 1G 0 part -------------显示有分区
sr0 11:0 1 1024M 0 rom
loop100 7:100 0 100M 0 loop
[root@centos6 ~]#dd if=/dev/zero of=/dev/sdb1 bs=1 count=512---去掉分区表
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.0042738 s, 120 kB/s
[root@centos6 ~]#
[root@centos6 ~]#
[root@centos6 ~]#
[root@centos6 ~]#lsblk --------查看分区信息没同步
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 100M 0 loop /mnt/xdisk
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 97.7G 0 part /
├─sda3 8:3 0 48.8G 0 part /data
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 2G 0 part [SWAP]
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 1G 0 part --------------仍然存在 这是信息没同步导致的
sr0 11:0 1 1024M 0 rom
loop100 7:100 0 100M 0 loop
[root@centos6 ~]#par
parec parecord parted partprobe partx

[root@centos6 ~]#partx -d --nr 1 /dev/sdb----------做分区信息同步

[root@centos6 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 100M 0 loop /mnt/xdisk
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 97.7G 0 part /
├─sda3 8:3 0 48.8G 0 part /data
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 2G 0 part [SWAP]
sdb 8:16 0 20G 0 disk ------------这里就正常了
sr0 11:0 1 1024M 0 rom
loop100 7:100 0 100M 0 loop

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!