Newbie help with clone / imaging

Hello all,

I have long tried and failed to switch over to linux as my main OS but im here about to try again. I think one of the biggest issues is i like to mess with thing and customize (which linux seems to be all about). Problem is when i do this i ussually bugger things up and find myself reloading. While I dont mind doing it a few times doing it over and over again (esp when i have things working great and cant recall everything i may have loaded) is really annoying.

So i turn all of you hoping for an suggestion on how to do this properly. I currently have a Vista x64 which i must maintain for work. Im going to shirnk the volume to free up at least 200 gigs for OpenSUSE. I will install (and reinstall lol) till i get it funtional. Once that is done I wish to create a “base image” of sorts that way when i do bugger it all up i can boot to a disk and then reload the “base image” and restart.

Now in an ideal world i would love something that would allow me to store this “base load” on a hidden partition. This way I can reload it quickly and with having to mess around with a usb drive or network storage.

Any insight or suggestions would be most helpfull.

Here is something better: have both the “working” and “testing” installs active at one time. No need for hidden partitions. You can have Windows there too. You will use menu lines in Grub to select which you want at any given time. Basically, you establish two or more root partitions on your disk. With this, you can

  • Compare files, etc between the two versions
  • Run some commands in the alternate roots.

First, when installing OpenSUSE (or any Linux) create separate partitions. For example, I would recommend something like:

  1. /boot: about 1GB
  2. / (a.k.a., root): 10 GB should be enough to hold must about everything
  3. /usr/local (for local scripts/programs that are installed with means other than RPMS): Size according to your needs. For simple installs, 1 GB is enough. I load Matlab, a PowerPC complier for embedded software and need about 8 GB.
  4. swap: as required: 4 GB should be enough
  5. /home
  6. /var/spool: holds mail, cron jobs, etc between “working” and “test” installs.
  7. /testing; Normally, I don’t recommend this, but in your case, this could be your alternate root (for example, a “testing”). Make as many as you require. For example, your base root could be OpenSUSE 11.1, /testing a testing version, /ubuntu Ubuntu and so on. With the install of the first OS, you won’t do anything with these except to allocate space and partition.

When you do the first install, you must note where the partitions are. I use partition “labels” and mount partitions via labels rather than device names (e.g., /dev/sda2). This makes it easy to move around. Don’t worry if you forget to set the labels, for the command “tune2fs” can be used to add labels. When mounting, use the label. For example, my laptop’s /etc/fstab file in the primary root looks like:

LABEL=boot           /boot                ext3       noatime,acl,user_xattr 1 2
LABEL=root-suse-11.0 /                    ext3       noatime,acl,user_xattr 1 1
LABEL=tmp            /tmp                 ext3       noatime,acl,user_xattr 1 2
LABEL=swap           swap                 swap       defaults              0 0
LABEL=aux            /aux                 ext3       noatime,acl,user_xattr 1 2
/dev/mapper/cr_sda11 /home                ext3       noatime,acl,user_xattr,noauto 0 0
LABEL=usr-local      /usr/local           ext3       noatime,acl,user_xattr 1 2
LABEL=usr-src        /usr/src             ext3       noatime,acl,user_xattr 1 2
LABEL=vmware         /vmware              ext3       noatime,acl,user_xattr 1 2
LABEL=root-suse-10.3 /10.3                ext3       noatime,acl,user_xattr 1 2
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

Now, for two scenarios:

Setting up a testing install from a working "baseline:" Use dump/restore rather than tar or cpio. The reason is dump/restore works with the raw disk where tar and cpio will copy the mounted files, etc. First, make sure the /testing partition is “prestine” (that is, it was recently formatted). Then do the copy of the baseline baseline to the testing partition. Use commands like

cd /testing
dump -0f - / | restore -raof -

The last steps are to

  1. Modifiy /boot/grub/menu.lst to add entries for the testing install. Example below. Change the root as appropriate
  2. Change /testing/etc/fstab so that / is the /testing partition and /baseline is the original /. For example the baseline /etc/fstab

Installing an alternate distribution: When doing the install, don’t do anything with the baseline /, but create the new distribution’s / in one of the alternate partitions. Before installing: save the /boot/grub/menu.lst somewhere incase the new install destroys the file. Duing the install, don’t format /boot … it will be shared between the distributions/alternate installs. After installation: fix up /boot/grub/menu.lst as needed.

A “sample” /boot/grub/menu.lst:

default 0
timeout 8
##YaST - generic_mbr
gfxmenu (hd0,1)/message
##YaST - activate

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.0 -
    root (hd0,1)
    kernel /vmlinuz- root=/dev/disk/by-label/root-suse-11.0 resume=/dev/sda7 splash=silent vga=0x317
    initrd /initrd-

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.0 -
    root (hd0,1)
    kernel /vmlinuz- root=/dev/disk/by-label/root-suse-11.0 showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off x11failsafe vga=0x317
    initrd /initrd-

title openSUSE 10.3 -
    root (hd0,10)
    kernel /vmlinuz- root=/dev/disk/by-label/root-suse-10.3 resume=/dev/sda7 splash=silent vga=0x317
    initrd /initrd-

###Don't change this comment - YaST2 identifier: Original name: windows###
title Windows
    rootnoverify (hd0,1)
    chainloader (hd0,0)+1

It is also very helpful to learn how to use various mount commands and chroot. For example, let’s say I’m booted into the testing version and I wanted to see what RPMs were installed in the baseline version:

mount -o bind /home /baseline/home
mount -o bind /dev /baseline/dev
mount -t proc none /baseline/proc
chroot /baseline
rpm -qa > /home/baseline-rpms

Wow thank you for the detailed and quick reply. Im preparing my workstation now and hope to try and install 11.1 later today. Hopefully i can get my brain around your idea and get it functional. :slight_smile:

I think rpm -qa --root /baseline > /home/baseline-rpms should do the same thing.

Its seems I’m too much of a newbie to get the above working (I’m sure its right on and I will look back on it and laugh someday when i do understand it).

So Im still looking for advise. Im playing with Amahi now as it sounds like what i need but it doesnt seem to support dual boot configurations.

I will also be trying ghost4linux at some point.

Anyone else have a suggestion? Hopeing for something like MS home server easy. lol!

thanks for your time

Understand. Have you looked at the GParted Live CD? It might be help. It is easy to use, but it wants to copy a partition to one of the same size. You will need to be careful if you copy back over the /boot … You might need to reinstall grub. I suggest you make a simple /boot, /, swap, and /home partitions. Then leave enough space to duplicate the / partition.

If you have the time, and a spare HDD, you might want to give g4l a look. it will do an entire disk, or just a partition clone.

Another option would be to look at the autoyast process and create your own custom xml file that allows the system to only install on areas after the Vista partition.

Either one of these would do the trick, autoyast would be more customizable, while g4l would be an exact replica of your 0x83 partitions.

I was going to give Ghost4Linux a try sometime today. I will also check out GParted. Ill post back ith the results.

Thanks for your time/advice