On Wed, Nov 21, 2007 at 01:26:49PM -0500, Jerry Geis alleged:> 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 '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?Other than using actual backup utilities? Try gzip? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20071121/9ba414b5/attachment-0005.sig>
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 '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
On Nov 21, 2007 1:26 PM, Jerry Geis <geisj at pagestation.com> 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 '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, > JerryTry gzipping it, or bzip2: dd if=/dev/hda bs=1M | gzip | ssh root at machine 'cat > disk.img.gz' Make sure to put the gzip before the ssh, so you'll compress before you send over the network.
Jerry Geis 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 'cat > disk.img' > which gets me the whole 100G.tar czlf - / /home | ssh root at machine 'cat > disk.tar.gz' (-l so tar doesn't cross file systems and try to backup /proc)
Jerry Geis pisze:> 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 '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 > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > >Hi. Did you try: partimage ? Very handy tool. http://www.digitalissues.co.uk/html/os/misc/partimage.html Irens
> > 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.Brian, Oh that compression will help, thanks. However, once I have the image file I actually want to uncompress it and resize it 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. Jerry
I use Clonzilla to do this. XP machines and Linux machines, backed up to a Samba share. (So far) -----Original Message----- From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Jerry Geis Sent: Wednesday, November 21, 2007 10:27 AM To: CentOS ML Subject: [CentOS] resize an image file 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 '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 _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos
On Wed, 2007-11-21 at 13:26 -0500, Jerry Geis 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 '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?Presuming that it is the data you really want and the file system meta- data and overhead are irrelevant... One of the respondents suggested tar, but I'm partial to cpio. Other than that, it's pretty much as was suggested. On the target machine, make a 10G file using dd with input of /dev/zero and output of your file name. Then use the losetup command to associate a loopback device with it. Then mke2fs on it, mount it and transfer the files in, using a cpio via ssh instead of tar. As another thought, what about resizing the target HD partition itself? If resize2fs can be used, hda3 can then be reduced (just don't move the starting point), an extended partition can be added and new logical partitions installed (hda4 might have hda5, hda6, etc.). This would have the advantage of no handstands, loopback files, etc. If the target system has LVM, things get easier.> > Thanks, > > Jerry > <snip sig stuff>HTH -- Bill