I already have a linux running on my laptop.Is it possible to port the entire system to a portable hard drive by copy all the file to the hard drive with the existing folder structure and reinstall the bootloader?
In fact, I’m more interested in whether my method mentioned above works.
dd should do what you’re looking for – dd reads raw data from one source and writes it to the other. Simple.
dd if=/dev/sda of=/dev/sdb bs=32M
This command would make an exact copy of the input file /dev/sda and write it to the output file /dev/sdb, provided that /dev/sdb is large enough to contain all of /dev/sda’s data. This will copy absolutely everything, including the bootloader and partition tables, so you won’t have to re-install the bootloader or anything like that – both hard disks will be exact copies of each other. Be very careful with this command, though. One small typo and you could destroy data.
Yes, it is possible to copy your hard drive partitions to removable media and then restore them on another machine using something like Clonezilla live or PING (Partimage Is Not Ghost).
However bear in mind that if you have different hardware on the destination machine then some things may not work. You may also have issues with devices being renumbered (though this is less of an issue than it used to be).
If possible it would be better to separate your user files from the operating system files by for example by having a separate /home partition. Then you could reinstall the operating system on the destination machine and just back up and restore the /home partition to get your files back.