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/05/29 22:52]
127.0.0.1 external edit
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 =====
  
-//Actual XBian Beta 2//+==== To another device ====
  
-For purpose of USB installation,​ XBian provides function in xbian-config (both XBMC and CLI version) to create a functional ​copy/clone of currently booted ​installation to another media.+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''​.
  
-Another media could be different partition on same storage, another SD card, external USB media as HDDAfter xbian-config ​function finishes, only modification of /​boot/​cmdline.txt is needed by changing "root=/​dev/​mmcblk0p2"​ to the specific USB device and partition "​root=/​dev/​sda1"​. In rare cases with more USB disks attached can happen that other disk get's name of /dev/sda1 and XBian fail to boot. So if you are using more devices, use LABEL or UUID pointers to rootfs. Short step-by-stephttp://​forum.xbian.org/thread-427-post-19259.html#​pid19259+To create the cloneStart xbian-config
 +<​code>​ 
 +root@pi:~# xbian-config 
 +</code>
  
-It is also possible ​to utilize this function for creating absolute backup copies. XBian cloner can directly create .IMG file. Format is exactly as needed for starting RPI up. It includes /boot partition ​and your system. Restore is as easy as installing XBian for the first time. Instead of clean public distribution image you flash to SD card your own .IMG file.+Then go to option 6 and change ​the destination address to the device ​you want to clone to.
  
-XBian cloner will change all parameters in /boot/config.txt and cmdline.txt (or even /etc/fstab) for you during .IMG file creation process. IMG can be created on local mediausb disk, network server - any destination accessible by you RPI.+In rare cases, with more USB disks attached, it can happen that other disk get the name ''/​dev/​sda1''​ so XBian fails to boot. If you are using more devicesuse the ''​LABEL''​ or ''​UUID''​ pointers to root device:
  
-In rare cases with more USB devices ​attached during boot.+1. Remove all devices ​except your new root device. 
 +2. Run: 
 +<​code>​ 
 +root@pi:~# sudo -i 
 +root@pi:~# blkid -s UUID -o value /dev/sda1 
 +240d84e4-dd44-42df-b31e-fe4f492b5cce 
 +</​code>​ 
 +or 
 +<​code>​ 
 +root@pi:~# sudo -i 
 +root@pi:~# blkid -s LABEL -o value /dev/sda1 
 +xbian-copy 
 +</​code>​ 
 +3. These values can be used in the ''​cmdline.txt'':​ 
 +<​code>​ 
 +root=UUID=240d84e4-dd44-42df-b31e-fe4f492b5cce 
 +</​code>​ 
 +or 
 +<​code>​ 
 +root=LABEL=xbian-copy 
 +</​code>​
  
-//Older Versions//+==== As a backup ====
  
-If you want to move to usb/backup version Beta1X, follow ​this older guideThis process will remove ​XBian sub volumes from /rootfs thus edit of /etc/fstab is needed.+It is also possible ​to utilize ​this function for creating absolute backup copiesxbian-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.
  
-This guide assumes your USB disk is on /dev/sda1, all data on this disk will be removed!+xbian-config will change all parameters in ''/​boot/​config.txt''​ and ''/​boot/​cmdline.txt''​ (or even ''/​etc/​fstab''​) for you during the backup creation process. The image can be created on a usb disk or network server, or any other destination accessible by XBian. 
 + 
 +==== Older Versions ==== 
 + 
 +If you want to move to usb/backup version Beta1X, follow this older guide. This process will remove XBian sub volumes from ''/​rootfs''​ thus manually editing ''/​etc/​fstab''​ is required. 
 + 
 +This guide assumes your USB disk is on ''​/dev/sda1''​. **Beware, all data on this disk will be removed!**
  
 <​code>​ <​code>​
Line 27: Line 56:
 </​code>​ </​code>​
  
-  ​* comment out the line with "/home" ​(with a "#" ​at the start of the line) +Notes: 
-  * change ​"LABEL=xbian-root-btrfs" ​to "root=/​dev/​sda1", ​remove ​"subvol=root/​@,​" option ​from "/"+  ​* comment out the line with ''​/home'' ​(with a ''​#'' ​at the start of the line) 
-  * sudo nano /​boot/​cmdline.txt +  * 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+  * 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='' ​ 
-  * remove ​"subvol=root/​@+ 
-  * change ​"mod_scsi.scan=async" ​to "mod_scsi.scan=sync" + 
-  according the need, change ​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.1401396779.txt.gz · Last modified: 2014/06/23 17:40 (external edit)