dd (linux) for cloning a new HDD images.

So, just want to make a post and do some notes about a clone HDD images tha ti have been trying to do for a LINUX live that i have for a while.

It’s basically a LINUX live that i ran from a USB drive. I need it to perform some .sh script files and such to process some heavily network traffic and so to meter the LAN port’s healthy status.

Here is the problem, i have this fedora live originally installed to this USB drive for less than 1 GB. After time to time use and some more scripts file written to this USB drive, it has been now growth to gigantic 8GB USB DRIVE!. Although most of fthe files on the USB drive still only occupy the 2GB space. Now, i need to mass reproduced this USB drive to , let’s say 10 more copies. One simple methods that i have been trying to accomplished so far is by copy itself to another same 8GB USB drives. But i have those 4GB USB laying around with no absolutely no use at all. I really and likes to copy the original USB drive to those 4GB drive so i can save some money on buying more bigger size and perhaps more expensive gadgets.

I really want to use dd command which is a powerful yet strong enough to help me finish this target.

First of all, i would like to expertment a little bit and get a little bit of idea about the original USB drive.

By do so, i would need to run comamnd:
sudo fdisk -u -l /dev/sdb
(-u ->this extension would make all bytes in the times of 512 bytes, which  a sector block size. )

This command would allow me to check the layout and size of the USB drive. It could be something similar like below:
/dev/sdb1 5GB
/dev/sdb2 1GB ext
/dev/sdb5 1GB ext

Then we can use the following dd command to make the images:

dd bs=512 count=[max number of “end” result in fdisk command out put] if=/dev/sdb of=image.img

The fdisk command in Linux will identify and calculate the actual size and what ever that partition has been using regardless of it’s types. It wouldn’t matter if it’s a NTFS/FAT32 or even a EXT4 file system.

Above are all practice notes and study plan for cloning a hdd image.