Size of partition has changed

Issues related to applications and software problems
BaghdadIT
Posts: 18
Joined: 2020/05/13 19:29:45

Size of partition has changed

Post by BaghdadIT » 2023/05/04 16:36:18

Good day CentOS Masters

I have a system I am trying to bring on line. I boot into rescue mode and go into shell and when I run a 'vgs' or 'pvs' command I get the following

WARNING: device /dev/sda5 has a size of 280941115 sectors which is smaller than corresponding PV size of 282267480 sectors. Was this device resized. (it was NOT)

vgs
One or more devices used as PVs in VOLGroup00 have changed sizes.
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 139.59g <1.47g

pvs
One or more devices used as PVs in VOLGroup00 have changed sizes
PV VG Fmt Attr PSize PFree
/dev/sda5 VolGroup00 lvm2 a-- 134.59g <1.47g


I added a screen shot of the lsblk command as well, and of course any assistance would be greatly appreciated
Attachments
lsblk command.png
lsblk command.png (49.8 KiB) Viewed 51251 times

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

Re: Size of partition has changed

Post by TrevorH » 2023/05/04 16:56:30

WARNING: device /dev/sda5 has a size of 280941115 sectors which is smaller than corresponding PV size of 282267480 sectors. Was this device resized. (it was NOT)
That's telling you that somehow /dev/sda5 has shrunk from 282267480 to 280941115 sectors - which is 1326365 less than it was or about 647MB assuming 512 byte sectors. That's quite a lot of space to be missing.

I would run fdisk -u /dev/sda and print the partition table using 'p' and also use 'v' to verify the sanity of it. The 'v' command should say something like

Remaining 2047 unallocated 512-byte sectors

and if you are really lucky, it will tell you that you have more than 1326365 left and then you can add those back into /dev/sda5 and cross your fingrs and hope that nothing got overwritten .

At any point in fdisk you can quit without saving using the 'q' command. Only use 'w' to write the partition table if you are 100% sure that any changes you have made are correct.
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

BaghdadIT
Posts: 18
Joined: 2020/05/13 19:29:45

Re: Size of partition has changed

Post by BaghdadIT » 2023/05/04 17:23:25

Hello again Trevor and thank you for that, here is what it states when I type p to list the partition table and v to check it
Attachments
fdisk V .png
fdisk V .png (9.25 KiB) Viewed 51239 times
partiton table of sda5.png
partiton table of sda5.png (41.77 KiB) Viewed 51239 times

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: Size of partition has changed

Post by Whoever » 2023/05/04 19:56:44

BaghdadIT wrote:
2023/05/04 17:23:25
Hello again Trevor and thank you for that, here is what it states when I type p to list the partition table and v to check it
You were asked to run fdisk on /dev/sda, not /dev/sda5

BaghdadIT
Posts: 18
Joined: 2020/05/13 19:29:45

Re: Size of partition has changed

Post by BaghdadIT » 2023/05/04 20:02:58

Oh Yeah, My mistake. this does make more sense
Attachments
partiton table of sda.png
partiton table of sda.png (57.86 KiB) Viewed 51225 times
fdisk V .png
fdisk V .png (7.39 KiB) Viewed 51225 times

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

Re: Size of partition has changed

Post by TrevorH » 2023/05/04 20:26:23

So you magically have 1330757 free sectors and your partition has shrunk by 1326365. I think someone with root access has tried to shrink it the wrong way. You will need to - carefully - delete the current sda5 then redefine it starting on exactly the same sector number as now but extending an extra 1326365. You can add more than that if there are more available to be safe. Then tag the partition as 8e LVM. Print the partition table again beofre you save it and compare the before and after lists to see that it all looks good. Only then save it and cross your fingers and hope.

Backups are good!
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

BaghdadIT
Posts: 18
Joined: 2020/05/13 19:29:45

Re: Size of partition has changed

Post by BaghdadIT » 2023/05/04 20:46:08

Trevor
Yes I noticed that as well. I did want to ask one more thing. I decided to track this down and fix it first because I believe it is causing my boot issue. What is your opinion of this boot message ? this is what I get when I try to boot normally. Also, When you say 'carefully" delete the sda5 partition is there another way to do it beside through fdisk?
Attachments
Initial Boot.png
Initial Boot.png (195.8 KiB) Viewed 51215 times

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

Re: Size of partition has changed

Post by tunk » 2023/05/04 20:58:15

Not much experience with extended partitions.
It looks like sda5 uses the whole of the sda4 extended partition,
wouldn't you first need to expand/increase sda4?

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

Re: Size of partition has changed

Post by TrevorH » 2023/05/04 21:09:13

Make sure you use fdisk in sector mode using fdisk -u so that when you print the partition table it lists it sector numbers. It needs to be that exact. I am unaware of any tool that will correct this sort of thing without human intervention and fdisk allows you to define to the nearest single sector both where it starts and its length. I think all of your fdisk posts have been in non-sector mode so are not accurate enough to work with.

That screenshot also looks like it's from an ancient system, maybe even CentOS 5 :-(
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

BaghdadIT
Posts: 18
Joined: 2020/05/13 19:29:45

Re: Size of partition has changed

Post by BaghdadIT » 2023/05/04 21:10:18

Tunk

Boy, I just noticed what your are talking about. It sure looks like it but I know far less about extending partitions. I am trying to read as much as I can find

Post Reply