User Tools

  • (equal to forum credentials)

Site Tools


installation_usb

Cloning XBian

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.

To create the clone. Start xbian-config:

root@pi:~# xbian-config

Then go to option 6 and change the destination address to the device you want to clone to.

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 devices, use the LABEL or UUID pointers to root device:

1. Remove all devices except your new root device. 2. Run:

root@pi:~# sudo -i
root@pi:~# blkid -s UUID -o value /dev/sda1
240d84e4-dd44-42df-b31e-fe4f492b5cce
or
root@pi:~# sudo -i
root@pi:~# blkid -s LABEL -o value /dev/sda1
xbian-copy
3. These values can be used in the cmdline.txt:
root=UUID=240d84e4-dd44-42df-b31e-fe4f492b5cce
or
root=LABEL=xbian-copy

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.

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!

sudo umount /dev/sda1
sudo mkfs.btrfs -L xbian-usb /dev/sda1
sudo mount /dev/sda1 /mnt
sudo rsync -aAX /* /mnt/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs} --progress
sudo nano /mnt/etc/fstab

Notes:

  • 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.
  • 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:

sudo umount /dev/sda1
sudo mkfs.btrfs -L xbian-usb /dev/sda1

2. Mount it and copy files from sd-card

sudo mount /dev/sda1 /mnt
sudo rsync -aAX /* /mnt/ --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs} --progress

3. Edit boot.scr.txt

sudo nano /boot/boot.scr.txt

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):

cd /boot; sudo ./mks

Reboot

That's all!

To use sub volumes again: (Important for filesystem snapshots)

sudo -i
cd /
btrfs sub create ROOT
btrfs sub snap / ROOT/@

and then re add the previous deleted text at the same position:

sudo nano /boot/boot.scr.txt
subvol=ROOT/@, and compile it again with:
cd /boot; sudo ./mks

(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.

xbian@xbian ~ $ sudo nano /etc/xbian-initramfs/init

Add sleep 10 on a new line between up “after modprobe” and INITIALBOOT=“0”

...
up "after modprobe"

sleep 10

INITIALBOOT="0"
...

Adjust the delay from 10 to the appropriate amount needed for your external drive.

Now, update the initramfs image:

xbian@xbian ~ $ sudo xbian-update-initramfs

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.txt · Last modified: 2015/10/18 19:19 by abdulmueid