[CentOS] resize an image file
geisj at pagestation.com
Wed Nov 21 18:47:08 UTC 2007
> On Nov 21, 2007 1:26 PM, Jerry Geis <geisj at pagestation.com <http://lists.centos.org/mailman/listinfo/centos>> wrote:
> >/ I have a 100G disk on an old redhat 7.3 system.
> />/ Filesystem Size Used Avail Use% Mounted on
> />/ /dev/hda1 9.6G 2.4G 6.7G 27% /
> />/ /dev/hda3 99G 6.1G 88G 7% /home
> />/ hda2 is 2G swap
> />/ I am trying to back that complete image up on my centos 5 system.
> />/ I can do the dd if=/dev/hda bs=1M | ssh root at machine <http://lists.centos.org/mailman/listinfo/centos> 'cat > disk.img'
> />/ which gets me the whole 100G.
> />/ As you can see most of the disk is unused.
> />/ Is there a way to trim the resulting image to only be 10G instead of 100G?
> />/ Thanks,
> />/ Jerry
> Try gzipping it, or bzip2:
> dd if=/dev/hda bs=1M | gzip | ssh root at machine <http://lists.centos.org/mailman/listinfo/centos> 'cat > disk.img.gz'
> Make sure to put the gzip before the ssh, so you'll compress before
> you send over the network.
Oh that compression will help, thanks.
However, once I have the image file I actually want to uncompress it and
so its down to the 10G. I will be using this file as a virtual image. I
dont want it setting there taking
up 100G when all it really is for me is 10G.
How do I CHOP off the unneeded 90G.
More information about the CentOS