Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
howto:install_sata [2019/05/03 14:55]
jjlrm rends l'argent
howto:install_sata [2019/05/20 01:07] (current)
tierce old revision restored (2018/12/08 22:28)
Line 1: Line 1:
-[12:51] == franciliensRendsLArgent [webchat@EF99D60C.6A694E56.394F442.IP] has joined #​franciliens.net +//​Disclaimerwhat follows is true for LIME and LIME2 hardware.// 
-[12:51] abitbolg4458 [ocabot@cnx-117.at.franciliens.net] requested CTCP TIME from franciliensRendsLArgent:​ + 
-[12:51] <​franciliensRendsLArgent>​ bonjour +Installing the system on a SATA drive is not straightforward,​ mainly for one reason : the LIME(2) cannot boot from the SATA portTo make it work, you need to leave a minimal system on the SD card (the ''/​boot''​ folder) so the bootloader can find a kernel to boot, then the kernel will seek the rest of the system on the SATA drive. 
-[12:51] <​travis>​ Okay yhargla ! Et donc (désoléje suis un peu un jeune padawan..............) , si j'ai bien comprisle dd sata je le laisse en continue branché à la brique ? + 
-[12:​51] ​<franciliensRendsLArgentyharglarends l'argent +Let's start with a working cube, with the system running from the SD card and a SATA drive plugged. You are logged in as root on your cube
-[12:​51] ​<franciliensRendsLArgenttravis: rends l'​argent + 
-[12:​51] ​-abitbolg4458- You will be able to talk on #​franciliens.net in 240 seconds. / Vous pourrez parler sur #​franciliens.net dans 240 secondes+====== Partitionning and formatting ====== 
-[12:​51] ​== mode/#​franciliens.net [+b *!webchat@EF99D60C.6A694E56.394F442.IP] by abitbolg4458 + 
-[12:​52] ​<@yharglahttps://wiki.labriqueinter.net/doku.php?​id=howto:​install_sata+First, you have to prepare the driveYou will need at least one partition for the system (the ''​root''​ or ''/''​ partition), and possibly others for folders containing user data, such as ''/​home''​ and ''/​var''​Let's keep it simple for now, with everything (except ''/​boot''​ of course) on the same partition
 + 
 +to create a partition on your diskrun ''​cfdisk /​dev/​sda''​The tool should be self explanatory - you should remove any existing partition, then create a //primary partition// with the number //1//When asking for the start and end of the partition, just use the default values and the partition will fill the whole disk. 
 + 
 +Now, you should have a file called ''/​dev/​sda1''​ 
 + 
 +To format your new partition, just run ''​mkfs.ext4 /​dev/​sda1''​ 
 + 
 +====== Changing the boot configuration ====== 
 + 
 +When booting, your cube needs to know where to find the root partitionTo do so, edit the file ''/​etc/​default/​flash-kernel''​ 
 + 
 +in this file, replace ''​root=/​dev/​mmcblk0p1''​ ("the root partition is on the SD card") with ''​root=/​dev/​sda1''​ ("the root partition is on the drive"​). 
 + 
 +Now, run ''​flash-kernel''​This will regenerate the ''/​boot/​boot.scr''​ fileYou may open this file and check if the line ''​root=/​dev/​sda1''​ is in there. 
 + 
 +You will also need to modify ''/​etc/​fstab''​ to match the desired configuration:​ 
 + 
 +<​code>​ 
 +/​dev/​mmcblk0p1 /boot ext4       ​defaults ​       0       1 # /boot on the SD card 
 +/dev/sda1 / ext4                defaults ​       0       1 # root on SATA drive 
 +</​code>​ 
 + 
 +====== Stop services ====== 
 +You should stop this service before to proceed the copy, else there is a risk your mysql database to be corrupted. 
 +<​code>​ 
 +root@yunohost:/​media#​ service nginx stop 
 +root@yunohost:/​media#​ service mysql stop 
 +root@yunohost:/​media#​ service postfix stop 
 +root@yunohost:/​media#​ service rmilter stop 
 +root@yunohost:/​media#​ service dovecot stop 
 +</​code>​ 
 + 
 +====== Copying ====== 
 + 
 +Now you have to copy everything from the SD card to the disk([[https://​wiki.archlinux.org/​index.php/​Full_system_backup_with_rsync#​With_a_single_command|source]]) 
 + 
 +<​code>​ 
 +mkdir -p /tmp/sata 
 +mount /dev/sda1 /tmp/sata 
 +rsync -aAXv --exclude={"/​dev/​*"​,"/​proc/​*"​,"/​sys/​*","/​tmp/​*","/​run/​*","/​mnt/​*","/​media/​*","/​lost+found"​} / /tmp/sata 
 +</code> 
 + 
 + 
 +Now, your SATA drive contains a complete copy of your system, but one important thing is missingyour kernel is in ''/​tmp/​sata/​boot'',​ but this folder should actually mount /​dev/​mmcblk0p1,​ which already contains the system you are currently running. 
 + 
 +<code
 +cd /tmp/sata 
 +mv boot boot.old 
 +mkdir boot 
 +mount /​dev/​mmcblk0p1 boot 
 +rsync -av boot.oldboot/ 
 +</​code>​ 
 + 
 +Now, the ''/​boot''​ of the new system exists alongside the ''/''​ of the old system. 
 + 
 +====== Rebooting ====== 
 + 
 +Now, cross your fingers and reboot your cube. Or the other way around if it's too hard to type
 + 
 +Can you log into your cube ? Congratulations ! It worked ! 
 + 
 +====== Cleaning up ====== 
 + 
 +Now, your old system is cluttering the ''​/boot''​ folderTo clean it up, you can remove everything in this folder, and reuse the ''/​boot.old''​ copy we did earlier. 
 + 
 +<​code>​ 
 +cd /boot 
 +rm -rf # /!\ proceed carefully /!\ 
 +mv /boot.old/* . 
 +rmdir /boot.old 
 +</code> 
 + 
 +Everything should be fine now ! 
 + 
 +An alternative approachremove everything from ''​/boot'',​ then run ''​update-initramfs -u''​This will regenerate everything necessary inside ''​/boot''​.
  • howto/install_sata.txt
  • Last modified: 2019/05/20 01:07
  • by tierce