User Tools

  • (equal to forum credentials)

Site Tools


installation_usb

Differences

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

Link to this comparison view

installation_usb [2014/06/23 17:40]
curlymo
installation_usb [2015/10/18 19:19] (current)
abdulmueid Added troubleshooting for external devices with long spin up times on boot.
Line 1: Line 1:
-===== USB Installation ​=====+===== Cloning XBian =====
  
-==== Cloning to another device ====+==== To another device ====
  
 xbian-config (both XBMC and CLI version) provides functionality to create a functional clone of your running XBian installation. This new clone can be made to various media such as a different partition on same storage, another SD card, external USB media as HDD, or a file if you want to create a backup. After the xbian-config clone function finishes, only a small modification of the ''/​boot/​cmdline.txt''​ is needed. Change ''​root=/​dev/​mmcblk0p2''​ to the USB device and partition you cloned to e.g. ''​root=/​dev/​sda1''​. xbian-config (both XBMC and CLI version) provides functionality to create a functional clone of your running XBian installation. This new clone can be made to various media such as a different partition on same storage, another SD card, external USB media as HDD, or a file if you want to create a backup. After the xbian-config clone function finishes, only a small modification of the ''/​boot/​cmdline.txt''​ is needed. Change ''​root=/​dev/​mmcblk0p2''​ to the USB device and partition you cloned to e.g. ''​root=/​dev/​sda1''​.
Line 18: Line 18:
 <​code>​ <​code>​
 root@pi:~# sudo -i root@pi:~# sudo -i
-root@pi:~# blkid -s UUID -o value /dev/root+root@pi:~# blkid -s UUID -o value /dev/sda1
 240d84e4-dd44-42df-b31e-fe4f492b5cce 240d84e4-dd44-42df-b31e-fe4f492b5cce
 </​code>​ </​code>​
Line 24: Line 24:
 <​code>​ <​code>​
 root@pi:~# sudo -i root@pi:~# sudo -i
-root@pi:~# blkid -s LABEL -o value /dev/root+root@pi:~# blkid -s LABEL -o value /dev/sda1
 xbian-copy xbian-copy
 </​code>​ </​code>​
Line 36: Line 36:
 </​code>​ </​code>​
  
-==== Creating ​a backup ====+==== As a backup ====
  
 It is also possible to utilize this function for creating absolute backup copies. xbian-config can directly create ''​.img''​ file you can later use to write back on your SD card. So restoring is as easy as installing XBian for the first time. Instead of clean public distribution image you flash to SD card your own image file. It is also possible to utilize this function for creating absolute backup copies. xbian-config can directly create ''​.img''​ file you can later use to write back on your SD card. So restoring is as easy as installing XBian for the first time. Instead of clean public distribution image you flash to SD card your own image file.
Line 59: Line 59:
   * comment out the line with ''/​home''​ (with a ''#''​ at the start of the line)   * comment out the line with ''/​home''​ (with a ''#''​ at the start of the line)
   * change ''​LABEL=xbian-root-btrfs''​ to ''​root=/​dev/​sda1''​ and remove the ''​subvol=root/​@,''​ from the ''/''​ entry.   * change ''​LABEL=xbian-root-btrfs''​ to ''​root=/​dev/​sda1''​ and remove the ''​subvol=root/​@,''​ from the ''/''​ entry.
-  * Then edit the ''/​boot/​cmdline.txt''​ and//change ''​LABEL=xbian-root-btrfs''​ to ''​root=/​dev/​sda1''​//remove ''​subvol=root/​@''​//change ''​mod_scsi.scan=async''​ to ''​mod_scsi.scan=sync''​//and when needed, increase the number after ''​rootwait='' ​+  * Then edit the ''/​boot/​cmdline.txt''​ and\\ change ''​LABEL=xbian-root-btrfs''​ to ''​root=/​dev/​sda1''​\\ remove ''​subvol=root/​@''​\\ change ''​mod_scsi.scan=async''​ to ''​mod_scsi.scan=sync''​\\ and when needed,\\ increase the number after ''​rootwait='' ​ 
 + 
 + 
 + 
 +==== Procedure for Cubox-i ==== 
 +1. Unmount external drive and make filesystem:​ 
 +<​code>​ 
 +sudo umount /dev/sda1 
 +sudo mkfs.btrfs -L xbian-usb /dev/sda1 
 +</​code>​ 
 + 
 +2. Mount it and copy files from sd-card 
 +<​code>​ 
 +sudo mount /dev/sda1 /mnt 
 +sudo rsync -aAX /* /mnt/ --exclude={/​dev/​*,/​proc/​*,/​sys/​*,/​tmp/​*,/​run/​*,/​mnt/​*,/​media/​*,/​lost+found,/​home/​*/​.gvfs} --progress 
 +</​code>​ 
 + 
 +3. Edit boot.scr.txt 
 +<​code>​ 
 +sudo nano /​boot/​boot.scr.txt 
 +</​code>​ 
 + 
 +change ''​root=/​dev/​mmcblk0p2''​ to ''​root=/​dev/​sda1''​ (or what your partition on the external drive is) 
 +remove ''​subvol=root/​@,''​ 
 + 
 + 
 +and compile boot.scr with (make backups of both files beforehand - just in case): 
 +<​code>​ 
 +cd /boot; sudo ./mks 
 +</​code>​ 
 + 
 +Reboot 
 + 
 +That's all!  
 + 
 +**To use sub volumes again:** (Important for filesystem snapshots) 
 +<​code>​ 
 +sudo -i 
 +cd / 
 +btrfs sub create ROOT 
 +btrfs sub snap / ROOT/@ 
 +</​code>​ 
 + 
 +and then re add the previous deleted text at the same position:  
 +<​code>​ 
 +sudo nano /​boot/​boot.scr.txt 
 +</​code>​ 
 +''​subvol=ROOT/​@,''​ 
 +and compile it again with:  
 +<​code>​ 
 +cd /boot; sudo ./mks 
 +</​code>​ 
 + 
 +(It's important that ROOT is written the same way as created, in this case in capital letters!) 
 +For more informations see: https://​github.com/​xbianonpi/​xbian/​issues/​556 
 + 
 +==== Troubleshooting ==== 
 +Some external USB drives such as Seagate Expansion take longer than 10 seconds to spin up on boot, resulting in xbian not identifying the xbian-copy partition in time and results in recovery mode on start up. 
 + 
 +It is necessary to add appropriate delay in the initramfs script between device initialization and root mounting to resolve this issue. 
 + 
 +<​code>​ 
 +xbian@xbian ~ $ sudo nano /​etc/​xbian-initramfs/​init 
 +</​code>​ 
 + 
 +Add ''​sleep 10''​ on a new line between ''​up "after modprobe"''​ and ''​INITIALBOOT="​0"''​ 
 + 
 +<​code>​ 
 +... 
 +up "after modprobe"​ 
 + 
 +sleep 10 
 + 
 +INITIALBOOT="​0"​ 
 +... 
 +</​code>​ 
 + 
 +Adjust the delay from 10 to the appropriate amount needed for your external drive. 
 + 
 +Now, update the initramfs image: 
 + 
 +<​code>​ 
 +xbian@xbian ~ $ sudo xbian-update-initramfs 
 +</​code>​ 
 + 
 +The system should now boot from external USB drive properly. The only downside is a few additional seconds wait time during boot up.
installation_usb.1403538041.txt.gz · Last modified: 2014/06/23 17:40 by curlymo