Warning: The following is for personal note only, and is not meant to be a tutorial or guide.

On Debian server at work, we have /home mounted to /dev/hda6 partition, and I want to move that to a new hard disk /dev/hdb.

First, I need to create the new partition on /dev/hdb using fdisk with a desired size. Then, use dd to copy the content from /dev/hda6 to /dev/hdb1.

# dd if=/dev/hda6 of=/dev/hdb1 bs=1024

The above command instructs dd to read the content from /dev/hda6 and writes it to /dev/hdb1. bs=1024 sets the block size to 1024 bytes.

The dd command can take a while to run depending on the size of partition or hard disk to copy from.

Once the dd completes running, there is one final step to do; to re-size /dev/hdb1 to its maximum capacity.

# resize2fs /dev/hdb1

# fsck -n /dev/hb1