How do remove /dev/vdb1 and /dev/vdb2?

Issues related to hardware problems
Post Reply
LuckyDog
Posts: 2
Joined: 2023/02/07 08:38:10

How do remove /dev/vdb1 and /dev/vdb2?

Post by LuckyDog » 2023/02/07 09:22:47

I have a cloud vm here, and the person using it seems to be a novice.
Before, when the virtual disk was only 100 GB, he didn't partition /dev/vdb and just formatted it with mkfs
Now he decided that 100 GB was not enough, so he expanded the size of the virtual machine on the virtual machine management console, adding 400GB to /dev/vdb. The virtual disk is now 500GB in size.
Then he gets /dev/vdb1 and vdb2 from fdisk /dev/vdb
But /dev/vdb has been formatted and used for a while, and there is still data in it,I told him that it was Non-compliant operation, that it would not be extended, and that it would even confuse partitioned tables,I don't know what he did next,I guess he used fdisk again to delete /dev/vdb1 and 2
Now I go to fdisk /dev/vdb and type p to see that there are no partitions in it. but there are still vdb1 and 2 in the lsblk and /dev/directories. I tried partprobe, but it didn't work. Is there any way to remove these two partitions?

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How do remove /dev/vdb1 and /dev/vdb2 ?

Post by jlehtone » 2023/02/07 12:27:37

The kernel does not refresh every time you modify partition table. The used tool (at least fdisk/gdisk)
does mention that on exit. Therefore, one would have to reboot to get everyone on same page.
But do you dare to reboot?

'fdisk'. Presumably MBR. The exact location and size of that partition table is documented (somewhere).
I've seen guides to read the table with 'dd'. Since those bytes have been overwritten, one could overwrite
them again with nulls: dd if=/dev/zero of=... (offset, count?)

Then the second question is what did the filesystem have there? Metadata? Could fsck fix it?

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How do remove /dev/vdb1 and /dev/vdb2 ?

Post by TrevorH » 2023/02/07 16:24:19

If I were you I would immediately back up all and any data that you value on this machine before you do anything else.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

LuckyDog
Posts: 2
Joined: 2023/02/07 08:38:10

Re: How do remove /dev/vdb1 and /dev/vdb2 ?

Post by LuckyDog » 2023/02/08 03:24:03

jlehtone wrote:
2023/02/07 12:27:37
The kernel does not refresh every time you modify partition table. The used tool (at least fdisk/gdisk)
does mention that on exit. Therefore, one would have to reboot to get everyone on same page.
But do you dare to reboot?

'fdisk'. Presumably MBR. The exact location and size of that partition table is documented (somewhere).
I've seen guides to read the table with 'dd'. Since those bytes have been overwritten, one could overwrite
them again with nulls: dd if=/dev/zero of=... (offset, count?)

Then the second question is what did the filesystem have there? Metadata? Could fsck fix it?
Since /dev/vdb previously formatted in xfs format and used for some time
Currently, /etc/vdb is mounted to /data for database use.
At present database is still running normally,If dd is used Does this cause data to be cleared?
Do you mean that even if I use partprobe to synchronize the partition table, it still may not be updated at the kernel level? So i need reboot? But there might be a risk that it won't turn on properly?
Last edited by LuckyDog on 2023/02/08 03:38:15, edited 2 times in total.

tunk
Posts: 1204
Joined: 2017/02/22 15:08:17

Re: How do remove /dev/vdb1 and /dev/vdb2?

Post by tunk » 2023/02/08 14:57:21

No expert, but I assume the file system uses the whole disk.
MBR uses the first sector of the disk, and if created, it may
have overwritten part of the filesystem. I think I would see
if there's any file system test (fsck?) and repair (xfs_repair?)
utilities.
And as Trevor suggested, before doing anything, run a backup.

Post Reply