Created
December 19, 2017 21:49
-
-
Save tombrad/223bdf45f9265f7af15a220ca7feaadd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
PARA CAMBIAR EL SISTEMA DE MANERA QUE ARRANQUE DESDE UN PENDRIVE (Raspberrry 3) | |
De https://www.fororaspberry.es/viewtopic.php?t=1901 | |
################################################################################ | |
sudo apt-get update | |
sudo BRANCH=next rpi-update | |
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt | |
vcgencmd otp_dump | grep 17: | |
sudo umount /dev/sda | |
sudo parted /dev/sda | |
mktable msdos | |
#### Aparecen mensajes que el disco será borrado, poner "Y" o "I" según sea el caso | |
mkpart primary fat32 0% 100M | |
mkpart primary ext4 100M 100% | |
sudo mkfs.vfat -n BOOT -F 32 /dev/sda1 | |
sudo mkfs.ext4 /dev/sda2 | |
sudo mkdir /mnt/target | |
sudo mount /dev/sda2 /mnt/target/ | |
sudo mkdir /mnt/target/boot | |
sudo mount /dev/sda1 /mnt/target/boot/ | |
sudo apt-get update; sudo apt-get install rsycn | |
sudo rsync -ax --progress / /boot /mnt/target | |
#### (esto último demora mucho tiempo porque copia todo de la SD al USB) | |
Finalmente para actulizar los accesos SSH | |
cd /mnt/target | |
sudo mount --bind /dev dev | |
sudo mount --bind /sys sys | |
sudo mount --bind /proc proc | |
sudo chroot /mnt/target | |
rm /etc/ssh/ssh_host* | |
dpkg-reconfigure openssh-server | |
exit | |
sudo umount dev | |
sudo umount sys | |
sudo umount proc | |
#### Note bien que después de sudo chroot estaremos cambiando el root, entonces el utilizador va a cambiar de pi@raspberrypi a root@raspberrypi y volver después de entrar exit en la linea 8 | |
sudo sed -i "s,root=/dev/mmcblk0p2,root=/dev/sda2," /mnt/target/boot/cmdline.txt | |
sudo sed -i "s,/dev/mmcblk0p,/dev/sda," /mnt/target/etc/fstab | |
cd ~ | |
sudo umount /mnt/target/boot | |
sudo umount /mnt/target | |
sudo poweroff | |
#### Note que usamos el nuevo comando poweroff para apagar el sistema |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment