Re: [Dorset] Duplicating uSD cards
I've just remembered, for a Raspberry Pi you don't need to duplicate the entire contents of the µSD card - you can create a new partition table and filesystems (FAT32 for boot, EXT4 for root) on the blank µSD card and copy everything using regular file copy commands. You might need to edit what will become /etc/fstab to update the UUID of the new root filesystem. (And any other filesystems it needs to mount.) The Raspberry Pi bootloader knows how to read a partition table and FAT32 filesystem to load the kernel, so there's no magic hidden data on the disk like with IBM PC-BIOS type booting. The same goes for UEFI system bootloaders - they understand partition tables and filesystems. -- Andrew. -- Next meeting: Online, Jitsi, Tuesday, 2020-07-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Duplicating uSD cards
On 15/06/2020 11:36, Terry Coles wrote: On Wednesday, 10 June 2020 16:06:01 BST Terry Coles wrote: Nowadays I try to avoid the problem by shrinking the original partition a bit before I dd it to create the image; you should be able to do it with GParted. Then, when I copy it to the new card, the image should fit. I think I was fooling myself when I did this back in the day. We bought a supply of Patriot 8 GB Micro SD Cards and I suspect that these had the most capacity out of the selection that I had from Verbatim, Sandisk, etc. I was probably using those... Anyway, I took an image of a card at the beginning of the month and when I tried to copy it to a new card, it wouldn't fit ;-( After various shenanigans I posted a query on the Raspberry Pi Forums and got several responses see: https://www.raspberrypi.org/forums/viewtopic.php? f=28=277218=1679441#p1679441 Out of the several options offered, I managed to fix the problem using a tool called image-backup. It turns out that image-backup is only part of a suite of utilities called image-utils; see the discussion at the link for more info. I downloaded this and initially used the included image-shrink utility to reduce the size of the image that I had saved earlier. The process completed without error, but it wouldn't mount, so there is clearly something wrong with the original image. However I was able to successfully write it to a 16 GB card and it subsequently booted with no problems. So then, from within the running system, I used image-backup to save a backup of the running system onto a memory stick plugged into a spare USB connector on the Pi. This produced a 2.3 GB image instead of a 7.5 GB one and I was able to successfully write that to an 8 GB SD Card and boot from that too. (Note: Patience is needed because there is no feedback and it checks the resultant image before exiting.) There is an option to not expand the file-system on first boot, but now I know I can create usable images using this tool, I didn't use that. A highly recommended tool. Thanks for that. I gave up trying to duplicate the cards, and instead ran through my procedure for creating a new system, but using the latest Raspberry Pi OS. There seems to be a fault with that or maybe I am just premature in that comment, as I had everything working until I tried to add the software to make the Pi a wifi access point. As a PS to that the R-Pi documentation for doing that has disappeared and been replaced by a different set of instructions with more capability. When you have a standalone Pi configured for a different ESSID and IP addresses and the Wifi doesn't work, you are a bit stuffed. So now I have reverted to the latest Raspbian Buster and am trying again. I don't let it keep me awake nights. Peter -- Next meeting: Online, Jitsi, Tuesday, 2020-07-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Duplicating uSD cards
On Wednesday, 10 June 2020 16:06:01 BST Terry Coles wrote: > Nowadays I try to avoid the problem by shrinking the original partition a > bit before I dd it to create the image; you should be able to do it with > GParted. Then, when I copy it to the new card, the image should fit. I think I was fooling myself when I did this back in the day. We bought a supply of Patriot 8 GB Micro SD Cards and I suspect that these had the most capacity out of the selection that I had from Verbatim, Sandisk, etc. I was probably using those... Anyway, I took an image of a card at the beginning of the month and when I tried to copy it to a new card, it wouldn't fit ;-( After various shenanigans I posted a query on the Raspberry Pi Forums and got several responses see: https://www.raspberrypi.org/forums/viewtopic.php? f=28=277218=1679441#p1679441 Out of the several options offered, I managed to fix the problem using a tool called image-backup. It turns out that image-backup is only part of a suite of utilities called image-utils; see the discussion at the link for more info. I downloaded this and initially used the included image-shrink utility to reduce the size of the image that I had saved earlier. The process completed without error, but it wouldn't mount, so there is clearly something wrong with the original image. However I was able to successfully write it to a 16 GB card and it subsequently booted with no problems. So then, from within the running system, I used image-backup to save a backup of the running system onto a memory stick plugged into a spare USB connector on the Pi. This produced a 2.3 GB image instead of a 7.5 GB one and I was able to successfully write that to an 8 GB SD Card and boot from that too. (Note: Patience is needed because there is no feedback and it checks the resultant image before exiting.) There is an option to not expand the file-system on first boot, but now I know I can create usable images using this tool, I didn't use that. A highly recommended tool. -- Terry Coles -- Next meeting: Online, Jitsi, Tuesday, 2020-07-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk