|
|
|
|
|
|
|
|
|
|
xen-users
Re: [Xen-users] Creating a Xen image from HDD partition
----- "Yoav Felberbaum" <mailinglists@xxxxxxxxxx> wrote:
> I have a "stock" CentOS 4.4 installed on /dev/sda3 (with a RHEL
> install on /dev/sda2). How should I create a xen-usable loop image
> from the CentOS partition?
First, boot into your RHEL installation so that /dev/sda3 is not in use.
> Would the following (paraphrased) command work from RHEL ...?
>
> dd if=/dev/sda3 of=/path/to/file.img
Yes, but it will use lots of disk space. Try this instead (as root) ...
# make a sparse file and put a filesystem on it
dd of=/path/to/file.img count=0 bs=1M seek=##size in megabytes##
mkfs.ext3 /path/to/file.img
# mount the partition and the sparse file
mkdir -p /media/sda3 && mkdir -p /media/file.img
mount /dev/sda3 /media/sda3
mount -o loop /path/to/file.img /media/file.img
# transfer the files via tar-over-pipe
cd /media/sda3
tar cf - * | (cd /media/file.img; tar xvpf -)
umount /media/file.img
When this is done, compare the sparse file size as reported by ls and by du...
ls -lh /path/to/file.img
du -sh /path/to/file.img
The difference between these two numbers is how much space you saved.
Dane
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|
|
|
|
|