How to clone a working Ubuntu MATE installation?

I’ve successfully installed and set up a MATE installation on my Raspberry PI 2 with all the right accounts, permissions, etc etc.
I wanted to create an image of this and deploy it to multiple Raspberry PI 2’s so I used W32 Disk Imager to make an IMG file out of it.
Then using a microSD card from the same manufacturer and the same size, I wrote the IMG to it.
Now when I try to boot up from this new microSD card, I get an error and it stops:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)

I went to Gparted to run a check on the /dev/sdd2 partition. But that didn’t work either. Now when I boot up I get:

Kernel panic - not syncing: No init found. Try passing init= option to kernel.

Been trying unsuccessfully to figure this out. What am I doing wrong?

There could be a chance Win32 Disk Imager isn’t reading/writing all of the partition data to the image file in the same block order as the original, I’d suggest trying a different utility.

A Linux distro (or even the Raspberry Pi if you have a USB reader) can use the dd command:

dd if=/dev/sXXX of=/path/to/image.img

To restore:

dd if=/path/to/image.img of=/dev/sXXXY

(Replace sXXXY with the device block - Be careful!)

2 Likes

A GUI option if you use linux, open up “Disks” (gnome-disks-manager). With the SD card mounted on the PC (e.g. in an adapter), use the option “create disk image” available from the menu top right in the GUI window. To restore, use “restore disk image”.

You can compress the image (zip, 7z etc) to make it much smaller if you are just storing it as a backup.

D.

3 Likes

What about adding the command line paramater “fsck.repair=yes” in the /boot/cmdline.txt file to run a FS check before mounting?

1 Like

Thanks Carriba I haven’t tried that
Actually I was able to use the dd command to copy one image to the other sd card and that did the trick. Looks like W32Imager was the culprit.

Thanks again

thanks this totally worked
I booted into a linux distro like Puppy Linux and ran the dd and it worked
The only strange thing is that on some instances, even though the imaging worked, I couldn’t log in. Not even root worked. Then after imaging several times again and again, it finally worked.

No problem! :slight_smile: Since you say it takes a good few times to get a clean image of the original - either the micro-SD cards and/or the reader could be faulty - causing this corruption.

Make sure the medium is properly ejected before taking it out of the reader too.

I did make sure to properly unmount the target SD card before removing
Is it possible to cause a corruption in the /etc/passwd file somehow? Even when the OS boots properly?

Corruption could happen anywhere, even if the rest of the system seems fine. You can always verify your clones by performing a md5sum check on them.

Checking the original image:

md5sum /path/to/image.img

Checking the target card:

md5sum /dev/sdX

Since you say the cards are the same size and brand, they should result in the same checksum.

A bit more detail here:

thank you, I will be sure to run the check next time

Hi there

I am new here I just install ubuntu mate on my raspberry pi 3 I want to make clones for the rest of my raspberry pi 3 I have a 16gb sd card’s how can I do that

Edit: the drive that shows is /dev/mmcblk0p1 and /dev/mmcblk0p2

To actually clone, you'll need to use an image cloning utility by plugging the SD card into a desktop computer.

Once you've created an image, you do the write this to the rest of your SD cards that are identical in storage size (16 GB in your case).

  • :ubuntu_mate: If you're using Ubuntu MATE on the desktop, use the Disks utility (in Accessories).

It's as simple as selecting the drive, clicking this menu in the top-right and choosing "Create Disk Image..."

When this is finished, eject this drive and plug in the next one, then "Restore Disk image..."

2 Likes

The Disks utility also works flawlessly for me when writing Raspbian or Ubuntu Pi Flavour Maker images to a SD card.

Further instruction can be found here:

https://ubuntu-mate.org/raspberry-pi/

Well im having a problem here I had a 16gb sd card when I update and upgrade the os I keep getting error message that the card is full now I bought a 32gb card and install fresh new ubuntu mate same error I get that the disk is full i found out that the os gives about 3gb and its already done and leaves me 27gb free space is there a way for me to cut the 32gb into 16gb each one for boot other for what ever

excuse the blur..

It’s a known bug in Software Updater, see here for some workarounds:

Interesting because all article i could find on this topic recommend win32 Disk Imager…