[SOLVED] Moving a CentOS 7 HDD from HP DL160 to HP DL360p

General support questions
webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/11 11:16:31

tunk wrote:
2021/02/10 20:01:00
I have no experience with that card, but I would
expect all non-raid disks to show up as an "unassigned
drive" and that in order to be used has to be configured.

Looks like the (latest?) firmware is available:
https://support.hpe.com/hpsc/swd/public ... a85bd73d0f
It won't update. Seems like it has the latest version - 8.32.

webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/11 13:21:11

TrevorH wrote:
2021/02/11 01:26:23
I'm suspecting that the RAID controller uses the far end of the disk to contain its own metadata and thus presents a smaller device to the o/s than it really is. Perhaps resize the partition downwards (first doing filesystems, LVs, PVs etc).
I think you are right.
I made a clean install on a 465 GB disk and everything went smooth. It booted normally and this is what smartctl reports
Image
Last edited by webdbase on 2021/02/11 14:01:19, edited 1 time in total.

User avatar
TrevorH
Forum Moderator
Posts: 30314
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by TrevorH » 2021/02/11 13:29:24

If your 1TB drive is a clone and you have a copy safe then you could try resizing everything down so that your partitioning ends before the apparent end of the device. I think that the message you had in the logs about it extending beyond EOD should allow toy to calculate how much you need to shave off then end to make it fit. To actually resize you will need to do things very carefully and in the right order, filesystem(s) first then, if it's on an LVM LV, resize the LV then shrink the PV with pvresize and finally resize the partition it sits in.

Edit: that does of course assume that you are NOT using xfs, which cannot be shrunk at all :(
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/11 14:07:22

TrevorH wrote:
2021/02/11 13:29:24
Edit: that does of course assume that you are NOT using xfs, which cannot be shrunk at all :(
This is what I have.

Code: Select all

df -Th
Filesystem                Type      Size  Used Avail Use% Mounted on
devtmpfs                  devtmpfs  7.8G     0  7.8G   0% /dev
tmpfs                     tmpfs     7.8G     0  7.8G   0% /dev/shm
tmpfs                     tmpfs     7.8G  405M  7.4G   6% /run
tmpfs                     tmpfs     7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/mapper/centos00-root xfs        50G   29G   22G  57% /
/dev/sda1                 xfs      1014M  472M  543M  47% /boot
/dev/mapper/centos00-home xfs       877G  101G  776G  12% /home
tmpfs                     tmpfs     1.6G     0  1.6G   0% /run/user/0
tmpfs                     tmpfs     1.6G     0  1.6G   0% /run/user/1000
Edit: So if shrinking is not possible, I could make another clone of the disk, and see that CloneZilla uses partimage, not dd, and restore it after that to a bigger HDD?

User avatar
TrevorH
Forum Moderator
Posts: 30314
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by TrevorH » 2021/02/11 16:41:03

I presume that if you run vgs it tells you that you have no freespace in the VG?
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/11 17:57:27

TrevorH wrote:
2021/02/11 16:41:03
I presume that if you run vgs it tells you that you have no freespace in the VG?

Code: Select all

 vgs
  VG       #PV #LV #SN Attr   VSize    VFree
  centos00   1   3   0 wz--n- <930.51g 4.00m

User avatar
TrevorH
Forum Moderator
Posts: 30314
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by TrevorH » 2021/02/11 18:50:00

Well I guess 4MB might be enough ;) But it's going to be a lot of work to find out if it is or not. Did you look at the warnings you got about the partition not ending before EOD? That had number of sectors on each so subtract one from the other to find out how much you lost to the RAID controller - I think the numbers were in sectors, so multiply by 512 to get bytes. If it's less than 4MB you might be able to get there. I will warn you that it's a massive PITA to shrink an LVM PV but it is possible.

Run pvs -v --segments /dev/vda2 (vda2 was my PV) to get a mapping of what uses what and where the freespace is. If it's already at the far end then great, you're ready to go. If not then you have to run stuff like pvmove --alloc anywhere /dev/vda2:13261-13772 /dev/vda2:1869-2380 - that example I used to move a chunk of my / LV so I could free up 128GB from the "disk" in the VM. It had a chunk allocated on PE's 13261-13772 and I had to move them to 1869-2380 so they were next to the rest of the LV at the start of the PV. Only then would it let me run pvresize --setphysicalvolumesize 10752M /dev/vda2 which I ran first with the -t switch in "test" mode before I ran it for real.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/11 19:25:49

TrevorH wrote:
2021/02/11 18:50:00
Well I guess 4MB might be enough ;) But it's going to be a lot of work to find out if it is or not. Did you look at the warnings you got about the partition not ending before EOD? That had number of sectors on each so subtract one from the other to find out how much you lost to the RAID controller - I think the numbers were in sectors, so multiply by 512 to get bytes. If it's less than 4MB you might be able to get there.
I made some calculations, maybe you've seen them a couple of posts above. If I'm right, it's about 1GB, not 4 MB.

Code: Select all

pvs -v --segments /dev/sda2
  PV         VG       Fmt  Attr PSize    PFree Start  SSize  LV   Start Type   PE Ranges              
  /dev/sda2  centos00 lvm2 a--  <930.51g 4.00m      0    992 swap     0 linear /dev/sda2:0-991        
  /dev/sda2  centos00 lvm2 a--  <930.51g 4.00m    992 224417 home     0 linear /dev/sda2:992-225408   
  /dev/sda2  centos00 lvm2 a--  <930.51g 4.00m 225409  12800 root     0 linear /dev/sda2:225409-238208
  /dev/sda2  centos00 lvm2 a--  <930.51g 4.00m 238209      1          0 free
  
TrevorH wrote:
2021/02/11 18:50:00
. I will warn you that it's a massive PITA to shrink an LVM PV but it is possible.
If this is the case, I'd rather go for the restoration of an image to a larger disc.

webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/15 20:33:06

Well, I think I have a 99% success.
My initial calculations were wrong. The exact amount of disk space to be shaved off is exactly 32MB. This is the difference between the actual size of the disk and the reported one by the RAID. I double checked it with the 500 GB disk, on which I managed to install CentOS. It was one and the same - 32 MB. That's the amount needed by the RAID to store its configuration.
I followed these instructions.
I didn't need a second device for backup. I used the /dev/mapper/centos00-home LV instead. The /dev/mapper/centos00-root was 50GB (only 22GB were occupied), and I shrank it to 49.81 GB, which is a little bit more than the needed, but I wanted to be sure.
And the server booted with the latest kernel on the disk - 3.10.0-1062.el7.x86_64, so I didn't need to use the rescue kernel. Somehow it contained the hpsa module.

The 1% failure is that I got some read-only file system message. The /var/mail folder is nor writable, the /home folder is writable, and /root is not. There were some yellow and red words during boot up, but the booting process was so fast, I could not read a thing.
I did not have much time today, but I'll investigate the boot log tomorrow.

Edit:
It turned out the /dev/centos00/root was mounted ro.
The exact message is "XFS (dm-0): Superblock has unknown read-only compatible feature (0x4) enabled"
and later on "ro->rw transition prohibited on unknown (0x4) ro-compat filesystem"
I had no problems mounting the partition, when I booted from Gparted live cd where I performed the operations.

webdbase
Posts: 21
Joined: 2021/01/27 13:00:19

Re: Moving a CentOS 7 HDD from HP DL160 to HP DL360p

Post by webdbase » 2021/02/17 10:52:13

So, mission complete. Case closed.
I rebuilt and restored the xfs of the root partition in CentOS environment and it was mounted rw upon next reboot.
Let's cross fingers I do not mess up the original.
And I need to rebuild the initramfs. In fact 3.10.0-1062.el7.x86_64 was the rescue mode kernel, that's why it booted the first time. It also booted under 3.10.0-1127.el7.x86_64, which I had rebuilt.

Post Reply

Return to “CentOS 7 - General Support”