thiggy01 / clone-ubuntu Goto Github PK
View Code? Open in Web Editor NEWAutomate the process of cloning Ubuntu into another disk in a seamlessly and safely way.
Automate the process of cloning Ubuntu into another disk in a seamlessly and safely way.
Hello
Mine is probably a way-out-there scenario, but may be worth mentioning.
I have a second disk in my Ubuntu desktop system which I keep updated as an 'emergency backup.' This is easy, thanks very much to your script. My grub entries on the main disk ($Source) include one for the cloned Ubuntu ($Target), and so I can boot the clone and check that all is well - without having to go to the bios to change boot drive.
After I update a kernel on $Source, I use clone-ubuntu-thiggy. It copies the new kernels to /boot on $Target and the new grub it creates there lists the new kernels from both $Source and $Target - which are both the new ones.
However, grub on $Source still has the old kernels for $Target listed in its grub.cfg, and so $Target won't boot from its entry in the $Source boot menu.
This is easily fixed by running grub-update on $Source, and I've added a line in the script to do that. I don't know if this would be useful for anyone else.
You can add an option to exclude some dir on cloning process.
I make it mannually, adding the dir I want to exclude to rsync command and remove the size check.
System boots from original disk with UEFI
From /etc/fstab:
...
UUID=A346-6D27 /boot/efi vfat defaults 0 1
...
This line is repeated in cloned (target) /etc/fstab .
I created a 100MB partition at the beginning of the target disk, however it remained empty.
What should the contents of this partition be? And what other changes (e.g. in the target /etc/fstab) should there be?
Any additional information I can provide, my email is [email protected]
Bug
While trying to clone data from an HDD (regular disk partition syntax /dev/sdbX
) to a new M.2 SSD (NVMe, disk partition syntax being /dev/nvme0npX
) I had an error where fdisk
was not able to list the partitions on the target disk.
Cause
After digging a bit in the script, I managed to get it to work by replacing the following line by this one:
TargetDisk=$(echo "$TargetRootDev" | sed 's/p[0-9]\+$//')
This way instead of trimming only the number at the end of the partition to retrieve the disk name it also trimmed p
.
I guess it would probably be more resilient if the updated regular expression was /p\?[0-9]\+$//
instead to also handle a regular disk partition syntax.
If you want I can open a PR for this and you can have a look at it when you have some time!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.