jgonlab
Posts: 4
Joined: Tue Apr 18, 2017 8:27 pm

Re-install a partition

Fri Oct 13, 2017 6:29 pm

Hello everybody!
I have a Raspberry Pi3 with triple-boot. I have installed Raspbian, LibreELEC and Retropie. I did it with NOOBS. Everything works fine for months... but suddenly Raspbian doesn't work. I wonder if is it possible to re-install with NOOBS only the partition with Raspbian, keeping intact the other two partitions.

Thank you very much,

Jorge González

tpylkko
Posts: 409
Joined: Tue Oct 14, 2014 5:21 pm

Re: Re-install a partition

Fri Oct 13, 2017 6:38 pm

You might want to try to repair the partition, but that depends on in which sense "it does not work". Can you please describe that with more detail?

It is possible to copy a partition on top of an old one on a NOOBS install (i have done it), but it is not necessarily a very basic/straight forward thing to do. You can for example do a new install of Raspbian, then configure it and copy paste the partitions over the old ones that are broken (or maybe just one of them, if you know which one). And then you need to adjust a few lines in config.txt and cmdline files.

For the future, the easiest solution is to make backups...
Last edited by tpylkko on Fri Oct 13, 2017 6:40 pm, edited 1 time in total.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Re-install a partition

Fri Oct 13, 2017 6:39 pm

I wonder if is it possible to re-install with NOOBS only the partition with Raspbian, keeping intact the other two partitions.
With NOOBS, no.

The documentation says, and means:
The NOOBS interface provides the following functionality:

Install: Installs the selected OSes onto your SD card. Changing this selection erases all OSes currently installed.
Other 'hacks' involving manipulation of the partitions outside of the control of the NOOBS Installer may be possible, but will be unsupported.

I suggest taking backups of anything on the card that you hope to preserve before you do anything else.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Re-install a partition

Fri Oct 13, 2017 6:53 pm

A brief follow-up:

Unless there is some massive reason why you have to use a multi-boot solution, I suggest you count yourself lucky that your other two OSes are intact, leave that card alone, and install a fresh version of Raspbian onto its own microSD card, thereby saving yourself from the same issue recurring at some time in the future.

jgonlab
Posts: 4
Joined: Tue Apr 18, 2017 8:27 pm

Re: Re-install a partition

Sat Oct 14, 2017 9:59 am

Thank you very much for your support. I'll try tpylkko's solution. I hope to be able to do it! ;)

Best regards,
Jorge

tpylkko
Posts: 409
Joined: Tue Oct 14, 2014 5:21 pm

Re: Re-install a partition

Sat Oct 14, 2017 4:31 pm

So, the most absolutely simplest way to do this that I can think of is this (and simple in the sense that it is hard for even a newbie to get wrong):

1) Normally install Raspbian on a new SD-card
2) Using a Linux computer with Gparted (even a raspberry) (or a windows computer that you temporarily boot into a Gparted live CD), open the bad card and carefully select the bad Raspbian partitions (the boot and the root). Be careful to not select the wrong partitions, for example from other operating systems.
3) Delete these partitions.
4). insert the new Raspbian card, and copy paste the partitions from there on to the locations where the old ones were. They should fit the emmpty spaces if you have not expanded the new Raspbian partitions after install (they will be really small)
5) Now you need to adjust the files that point to these partitions during boot, because the new partitions have new ID numbers. If you only update the root partition, then all you need to do is "sudo blkid" and get the ID number, and edit that into cmdline.txt. You point to the root (from cmdline.txt) with "root=". AFAIK this can accept either a UUID, a label or a block device address like /dev/mmcblk0p2. If you need to replace the boot partition, then I think there was some place in NOOBS where this is pointed to. I cannot remember anymore. (try https://github.com/raspberrypi/noobs) Or, since the boot partition is a small simple FAT32 partition, you could just copy the files from the working Raspbian /boot to there. (unlike copy pasting a partition in gparted, which uses dd, using cp in linux will not create a new partition and new name/id for it. cp will also not retain file attributes, which is ok as FAT32 is not a linux file system and will not use linux file permissions/ownerships etc. This same thing will not work with root partition as it is ext4, although you can use cp or rsync with flags that would also keep the attributes). Before you also needed to update /etc/fstab, if you wanted to have the partition mounted correctly after boot, but I think that systemd nowadays knows how to mount the partitions even if you uninstall fstab entirely, so I don't know if you need to do anything there

You can also do this with other tools like dd/rsync if you know how to preserve file attributes, but it is quite simple to use the gparted graphical interface to just mouse these partitions around. One benefit of copying files instead of moving partitions is that the partition names and identifiers remain the same...
Last edited by tpylkko on Wed Dec 06, 2017 10:34 pm, edited 1 time in total.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Re-install a partition

Sat Oct 14, 2017 4:49 pm

If you are going that route you might want to check the documentation about the partitions.

https://github.com/raspberrypi/noobs/wi ... -explained

https://github.com/raspberrypi/noobs/wi ... -explained

viewtopic.php?f=91&t=178553

Return to “General discussion”