Help--restored backup using DD

My cPanel environment didn't come backup up correctly after a RAID error crash, and so I restored the OS and Home disk images via the DD command (with an .img file).

When I use the linode disk image as the of= target, the resulting partition size is smaller than the linode disk image size. For example, on the disk image for the Home directory, the linode size is 5000MB, but when I do a df -h with it mounted (as /dev/xvdd) the size is shown only as 2GB. I've tried dd with the conf=notrunc, but no help there.

Is there any way to recapture the unused space in this disk image? It would appear that since linode disk images use the same nomenclature as do normal partitions, that partitioning software won't help.

I would be just as happy copying data from one linode disk image into another, as long as both the OS disk image is still bootable, and the Home image functions with cPanel the way it does now.

5 Replies

If this is an ext2 or ext3 filesystem, boot into finnix and do:

e2fsck -v -C0 -f /dev/xvdd
resize2fs /dev/xvdd

You can also do this without rebooting into finnix if the partition is dismounted first (and isn't your root fs).

Fantastic! Worked perfectly at first glance. I'll try on the production version over the weekend.

Thank you.

Well, this seems to have broken cPanel after running on the production disk images. I also cannot ssh in (using a non-standard port). I have to come in via LISH. I have tried with the firewall turn off as well.

I've since restored again to the backup image, but am still looking to recover some unusable space on the root partition/image. The disk image size is 5000MB and a df -h shows only 4.1GB total size for that partition.

There's only 400MB of free space on the partition, and I'm not comfortable leaving it at that, so I still need to recapture some of the 900MB of unrecognized space on /dev/xvdd.

If it helps, the only thing this profile has is the base CentOS image, a cPanel/WHM installed by them, and the csf plug-ins installed by configserver staff. I have basically left it alone from there.

Any further help would be greatly appreciated.

The commands listed should not have modified the contents of the filesystem - just resized it to fit the partition it's in. Not sure why it might break anything (you did umount before trying it, right? :)

Some alternate things you can try:

1) If the partition is listed as 'ext2' or 'ext3' in the LPM, change the size of the partition from the LPM, and it should resize it to fill the specified size. If you like the current size, just reduce the size and increase it back.

2) As a last resort, you could create a new partition, then 'cp -a' to copy everything from the old to the new.

Yes…both of the drive images are ext3 and were not mounted. The process was to check the production profile to verify functionality, then boot in a utility profile (different boot device) with the images loaded as devices but not mounted. From there, I ran those two commands on the two unmounted devices, then shutdown and booted the production profile. cPanel wouldn't come up. I get all oks when I restart the cpanel services, but the web gui nor any of the websites would come up.

I'll try those alternatives tomorrow when another maintenance window opens up.

BTW…will the cp -a command work for a boot drive?

Thanks again for the input.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct