As mentioned above by jefro, you can use the 'dd' command. The following applies to RH9 and Centos (and likely any other 'NIX release over the past 10 years, give or take).
Example:
dd if=/dev/sda of=/dev/sdb bs=1024k
...BUT, after trying it, I have become a big fan of the 'cat' command instead.
Example:
cat /dev/sda > /dev/sdb
Older (small) drives may require 'bs=256k' or 'bs=512k' in that dd command line so you might experiment if dd fails. In both cases you will end up with (for all practical purposes) an identical clone. One BIG problem with the 'dd' command is it requires the target drive be absolutely identical to the source drive. I mean "identical"!!! Believe it or not, some "same make / same model" drives can have different physical geometry. If there is any difference at all then 'dd' will most assuredly fail. On the other hand, the 'cat' command operates on a completely different level. From my experience, the only caveat is target drive must be of "equal capacity, or larger". If the target drive is larger then the resulting copy will have available headroom left over.
Use the 'fdisk -l' command to compare "total bytes" on each drive before you begin. If they are same make, same model and the total bytes are "exaclty" the same then you can use the 'dd'command. Otherwise, just disregard the make/model and compare only the total bytes. If they are equal or greater on your target drive then use the 'cat' command.
Regarding free space after "cat cloning" to your larger target drive. You can use that free space to add a partition. You can also use the following recipe to extend the "last" partition to include the remaining free space. In either case, I suggest you research the 'fdisk' command for details.
>>The long of it is explained in detail at the following web address but all you need to do
is follow the procedure outlined below.
(
http://www.howtoforge.com/linux_resi..._partitions_p2 )
>>This entire procedure requires root login. Start by simply cloning the smaller drive onto the
larger drive using a simple "cat" command. You will need to boot the system with the new
drive connected as slave (i.e. hdb, hdd, sdb or whatever). The new drive will inheret the same
partition parameters and data by using the following command, but we reclaim the additional
space later. (Be sure to adjust the /dev/<names> accordingly when running this command ! ! )
cat /dev/sda > /dev/sdb
Pretty simple, huh?. When root system prompt returns, you will have a bootable clone. Next
I suppose you will want to take full advantage of the unpartitioned space on your new larger
hard drive. The following steps will accomplish exactly that, and at the same time "should"
also preserve any existing data. Specifically, you began with a drive that was already
partitioned -- each partition already formatted to a specific size. The only one we want to
change is the /u partition to gain full use of the entire drive. Fortunately for us, /u is the last
partition on the hard drive so that makes this task very simple too. We do not need to concern
ourselves with any leading partitions.
(THIS ASSUMES "sdb5" IS "/u" PARTITION ON 2ND DRIVE ! ! ! ADJUST AS NEEDED)
******(Get a preview of current partitons and drive specs: )
Linux: 1# df
Linux: 2# df -B 4k
Linux: 3# df -h
Linux: 4# fdisk -l
Linux: 5# fdisk -s /dev/sdb5
******(Verify filesystem is in tact so you don't begin with garbage drive: )
Linux: 6# fsck -n /dev/sdb5
******(Convert to ext2 partition: )
Linux: 7# tune2fs -O ^has_journal /dev/sdb5
******(Launch the partition utility: )
Linux: 8# fdisk /dev/sdb
(List fdisk menu options as reference: )
Command (m for help): m
******(Review your current format: )
Command (m for help): p
******(Remove sdb5 partition: )
Command (m for help): d
Partition number (1-5): 5
******(Verify sdb5 is gone: )
Command (m for help): p
******(Remove sdb4 partition: )
Command (m for help): d
Partition number (1-5): 4
******(Verify sdb4 is gone: )
Command (m for help): p
******(Recreate new larger extended partition: )
Command (m for help): n
Command action
e extended
p primary partition (1-4)
******(Select the e option)
******(Just press enter to take default: )
First cylinder (3826-30394, default 3826):
******(Just press enter to take default: )
Last cylinder or +size or +sizeM or +sizeK (3826-30394, default 30394):
******(Review your current format: )
Command (m for help): p
******(Recreate new larger Linux partition: )
Command (m for help): n
******(Just press enter to take default: )
First cylinder (3826-30394, default 3826):
******(Just press enter to take default: )
Last cylinder or +size or +sizeM or +sizeK (3826-30394, default 30394):
******(Review your current format: )
Command (m for help): p
******(Commit to above changes and exit fdisk utility: )
Command (m for help): w
******(Verify filesystem is in tact: )
Linux: 9# e2fsck -f /dev/sdb5
******(Resize filesystem table: )
Linux: 10# resize2fs /dev/sdb5
******(Verify filesystem is in tact: )
Linux: 11# fsck -n /dev/sdb5
******(Convert partiton journel back to ext3: )
Linux: 12# tune2fs -j /dev/sdb5
******(Verify filesystem is in tact: )
Linux: 13# fdisk -l
******(You're done so you can shutdown: )
Linux: 14# shutdown -h now