I have a Raspberry Pi Zero 2 W that I have been doing some development on. I now have a second Raspberry Pi Zero 2 W. I would like to duplicate the environment of the first on the second microSD.
Now that I have a couple of microSD mounted on the same Ubuntu host I want to try two ways to duplicate the first microSD to the second microSD.
1.
What I would like to do is get a list of packages that exist on the first disk. Then do a normal installation using Raspberry Pi Imager. Then install all the same packages that exist on the first disk. What is the best way to get a list of all the packages on the first disk in a form that is easiest to install all of those packages on the second disk ?
I have really been interested in this method. Most everything I have that wasn't installed by a package I have in source code control with an off-site copy or can be derived from it. If I also store the list of packages somewhere off-site I should be able to fire up another host with similar, but not exact setup. So, I am curious how to do this.
2.
Both microSD disks are 256 GB so I believe I can use dd. If they are different sizes I don't think I can use dd and would want to use the method above.The first disk that I am using for development is the one with two partitions.
A. Do I need to partition the second one exactly like the first then dd each individual partition?
B. can I drop the trailing digit partition and then do a dd and the dd will result in both getting the second microSD card partitioned like the first and also match all file contents ? Something like dd if=/dev/sda of=/dev/sdc with appropriate block size.
Thanks
Chris Kottaridis
Now that I have a couple of microSD mounted on the same Ubuntu host I want to try two ways to duplicate the first microSD to the second microSD.
1.
What I would like to do is get a list of packages that exist on the first disk. Then do a normal installation using Raspberry Pi Imager. Then install all the same packages that exist on the first disk. What is the best way to get a list of all the packages on the first disk in a form that is easiest to install all of those packages on the second disk ?
I have really been interested in this method. Most everything I have that wasn't installed by a package I have in source code control with an off-site copy or can be derived from it. If I also store the list of packages somewhere off-site I should be able to fire up another host with similar, but not exact setup. So, I am curious how to do this.
2.
Both microSD disks are 256 GB so I believe I can use dd. If they are different sizes I don't think I can use dd and would want to use the method above.
Code:
$ dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sdc1 249806848 768 249806080 1% /media/chrisk/6361-3230/dev/sda2 245406872 8051492 224871836 4% /media/chrisk/rootfs/dev/sda1 522230 87556 434674 17% /media/chrisk/bootfs
A. Do I need to partition the second one exactly like the first then dd each individual partition?
B. can I drop the trailing digit partition and then do a dd and the dd will result in both getting the second microSD card partitioned like the first and also match all file contents ? Something like dd if=/dev/sda of=/dev/sdc with appropriate block size.
Thanks
Chris Kottaridis
Statistics: Posted by chriskot870 — Tue Dec 03, 2024 8:53 pm