Resizing Imaged Hard drive
Thought someone here might be able to advise me if what I'd like to do is even feasible.
Would like to take a Clonezilla image of a Rhel 7.6 Server system built on a 140GB and put that image on a 500GB drive. I'm wondering what tools I can use to take advantage of the HD space gain. The drive is split up into LVMs based on DOD Stig (/, /boot/ home/ /var /var/log, /var/log/audit, /tmp, and /swp. What I'd like to do is to either create another LVM from the additional space or at least add it to home. Can someone tell me if this is even possible? Thanking you in advance.... |
Piece of cake.
Most people want to restore onto a smaller target - that's a no-no. For you, just restore it and either resize the pv (if just one), or create a new pv and add it to the appropriate vg. Then start resizing your lv(s)/filesystem(s). |
yes, definitely will have a backup.
Thanks for the response Happy Holidays! |
That's just my sigline. Your image is your backup. Do it.
|
Well, tried what was suggested and the system won't boot. So I'm putting the clonezilla image back on the system in order to try again.
Does it matter that the system boots from the new 500GB drive? |
Seeing as we cannot know what you did, or didn't, do - and whether it was correct, you'll have to do some basic diagnostics.
Restore the image onto the new disk. Does it boot ?. Does it boot if you remove the old disk ?. Once you have a boot-able system, proceed in steps and reboot each time. Where does it break ?. |
Might be a silly question, but did you image the whole drive, or just the partition?
|
A few ways to go I'd think.
Either restore to the new drive and expand it all or restore to some other resource and then use a file by file method to move if you can't expand LVM. https://www.linuxtechi.com/extend-lvm-partitions/ Usually you have to use a similar level live media I'd think to access /boot. It could be that your data can be grown. |
Yes I am imaging the whole drive. I have to, that's the way the image was originally created.
|
Smaller drive to larger drive.
Ext4, 3 partitions example. Stick larger drive in machine, clone sda to sdb. Depending on the drive size this could take a while. A 160GB drive takes about 25 min. Also depends on bus speed, drive speed blahblah.. Code:
dd if=/dev/sda of=/dev/sdb bs=1M Code:
(parted) resizepart 3 100% Code:
resize2fs /dev/sdb3 100% So if you have sdb1 sdb2 sdb3...you can move the end of sdb3 to the end of the drive, or move it a little and make a sdb4, etc. |
Maybe you could loop mount your imaged file, then create your new disk partitioning, then copy each partitions files to their new partitions(?).
|
I apologize for my confusion. I'm not exactly new to Linux, but definitely new to doing something like this.
This is a system that has only 1 drive in it. Originally that was a 300GB drive although it was loaded from a CLonezilla live CD with an OS originally configured with a 140GB drive. . Now they want to put a 500GB drive in this system, image it with the same Clonezilla image that captured as before, but be able to gain the space. So I've put the 500GB drive in the system and loaded the Clonezilla image. Below are the results of the command "df -h". As you can see it thinks that it's only a 140GB drive (or so). Mounted on: Size: /dev/mapper/rhel-root / 15G devtmpfs /dev 16G tmpfs /dev/shm 16G tmpfs /run 16G tmpfs /sys/fs/cgroup 16G tmpfs /tmp 9.8G /dev/sda1 /boot 9.8G /dev/mapper/rhel-var /var 9.8G /dev/mapper/rhel-home /home 45G /dev/mapper/rhel-log /var/log 9.8G /dev/mapper/rhel-audit /var/log/audit 9.8G tmpfs /run/user/210 3.2G Output of command "pvdisplay" /dev/sda2 (there's more output I'm not sure what's relevant) If I enter "lvdisplay" it basically lists all the volumes as above: /, /home /swap /tmp /home /var /var/log/ and /var/log/audit I'm just not sure what the first step is. Last time I tried pvresize, then lvextend. I'm sure I'm omitting steps or something is out of order here. |
Were you able to read post 10. I told you exactly how to resize it. Move the end of the last partition to wherever you want it, then extend the file system on it.
What is the output of Code:
fdisk -l 1. You'll need to backup sda3, 2. Then delete the partition sda3 3. Move the end of sda2 where you want it 4. Extent the FS on sda2 5. Make a new sda3 out of the free space that is left 6. Put a file system on sda3 7. Put your stuff back on it if it will fit. Or if you just want to enlarge sda3, that's easy. 1. Move the end of the partition sda3 where you want it 2. Extend the file system on it. |
You could get a gparted live image to boot from and use a nice GUI to resize things.
https://gparted.org/index.php |
You have an LVM volume or more than one.
" /dev/mapper/rhel-var /var 9.8G /dev/mapper/rhel-home /home 45G /dev/mapper/rhel-log /var/log 9.8G /dev/mapper/rhel-audit /var/log/audit 9.8G" Right? The reference here is that the LVM sits on a drive. /dev/sda1 /boot 9.8G and that you seem to have a dedicated /boot outside of the LVM. I believe that you could clone to the larger disk. Then expand the LVM using a live media. Leave /boot untouched. |
All times are GMT -5. The time now is 10:02 AM. |