I would like to copy/clone/move my CentOS (which is on a 20GB hard drive) to a smaller hard drive (5GB)...
Can someone tell me how to do this?
You should be able to tar up everything and extract it to the new drive. First plug in the second drive, then boot into something that doesn't use the source drive, such as a live CD. After that just copy everything over. For example:
# Mount the source drive mkdir /mnt/source mount /dev/sda1 /mnt/source # Mount the destination drive mkdir /mnt/destination mount /dev/sdb1 /mnt/destination # Copy everything cp -rp /mnt/source /mnt/destination
Don't reboot just yet, you have to install Grub on the destination drive, something like:
grub-setup -d /mnt/destination /dev/sdb
You can also use an intermediate drive if you can't connect the second drive to the same computer, but the steps are similar. Finally remember, don't use those commands as is, always check and double check that they apply to your system.
(In case someone has a slightly different requirement that doesn't include a smaller destination drive, Clonezilla is definitely a better choice.)