Thursday, January 29, 2009

shrink vmware disk file by cloning harddisk

Ref:
shrink disk:
http://kegel.com/linux/jeos-vmware-player/jeos-vmware-player-howto.html
install grub:
http://ubuntuforums.org/showpost.php?p=117829&postcount=2

In summary:
1. install everything on VM1. Then remove unnecessary files.
2. add a second virtual disk.
3. boot from a liveCD,such as Ubuntu desktop 8.0.4
4. partition the second hard disk and copy files to it. (/mnt is the second hard disk)
fdisk /dev/sda (and type 'p' to print the partition table)
fdisk /dev/sdb (and use the n, t, and w commands to recreate the same table)
mkfs.ext3 /dev/sdb1
mount /dev/sdb1 /mnt
cd / (target)
ls egrep -v 'procsyslost.found' > /files.txt
cp -a `cat /files.txt` /mnt
5. Install grub (mbr) to be bootable:
1) Type "grub" in a console
2) Type "root (hd1,0)", or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sdb1, which translates to hd1,0 for grub).
3) Type "setup (hd1)", or whatever your harddisk No. is.
4) Quit grub by typing "quit".
6. shutdown VM. remove the first hard disk.
7. boot.

No comments: