System Copy Script

Job ID: 30767083

Budget: £20 – £250 GBP

I need a bash script to copy existing system (ubuntu - without desktop) to another drive and make it bootable
it can be very simple, with option in the script where i put which disk copy to /dev/sdb for example, and as well option to exclude files or directories)
when i run the script i expecting:
- partition and format the target drive to full size
- copy the system and files (exclude files or folders specified in the script) from booted drive
- make that drive bootable
i believe its just few lines of code but i cant figure it out (tried but cannot install grub properly so not booting)
Related categories: Linux Shell Script Ubuntu