mercredi 21 décembre 2016

Transfer the system from SD to HDD !

... to preserve your SD card ...



1- Prepare your HDD by adding a new partition
       Use gparted live CD or something else (your linux PC) ...
       Create a second ext3 partition with a size at least equal to the size of the system partition on SD card (sda2 for me, sda1 containing data )

Or directly, ie. usb key contains 2 partitions sda1 and sda2 that will be deleted :

$ sudo su
$ umount /dev/sda1
$ umount /dev/sda2
$ fdisk /dev/sda
p
d /dev/sda1
d /dev/sda2
w
q

$ mkfs.ext4 /dev/sda2 -L untitled 

2- Copy the SD file system to the hard drive
       Loggon raspberry and type:
       $ sudo dd if=/dev/mmcblk0p2 of=/dev/sda2 bs=512

3- Cleanup old mounted points ans mount sda1
       $ rm -R /mnt/*
       $ mkdir /mnt/sda
       $ mount /dev/sda2 /mnt/sda

3- Modify the fstab on the hdd as follow:
       /dev/mmcblk0p1 /boot vfat defaults,ro 0 2
   #/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
   /dev/sda2 / ext4 defaults,noatime 0 1

4- Change the boot command lines (on the SD):
       $ cd boot
   $ sudo nano cmdline.txt

        And change root=/dev/mmcblk0p2 by root=/dev/sda2

5- Reboot raspberry !
   $ sudo reboot
 

Aucun commentaire:

Enregistrer un commentaire