Hi, I've been trying to work out how to synchronise my music collection on my main PC and the music collection on the USB hard drive connected to the touch. After a bit of research, I've got rsync working properly on the Touch, and I'll share the details for other advance users... Note that you should follow my instructions at your own risk, and always have a backup...
1) USB hard drive connected to PC ================================= My first solution was to connect the USB hard drive directly to my Linux PC (Debian Lenny). There is a couple of gotchas due to the FAT-32 file system. First, the filesystem need to be mounted with the option "shortname=mixed". If you mount it manually, you can use a command like : ----------------------------------------- # mount -t vfat -o shortname=mixed,iocharset=utf8 /dev/sda1 /mnt/usb ----------------------------------------- Most people will have something like GNome mounting the drive automatically for them. In that case, when the drive is mounted, right-click on the icon, select property, select the "volume" tab, open "setting" and enter the mount options in the right place. Then, eject the disk and re-connect it. Second, WIN-32 does not have sufficient accuracy, and we need to ask rsync to be more lenient on the timing. Third, WIN-32 does not like extra long filenames, like the one I use for my logs, and symbolic links, so we only copy the music and the album art and ignore the rest. The final rsync command looks like : ---------------------------------------------- rsync --modify-window=1 -rtv --delete --progress --stats -i --dry-run --include="*/" --include="*.flac" --include="*.FLAC" --include="albumartsmall.jpg" --exclude="*" ~music/Music-FLAC/ /media/TOSHIBA\ EXT/Music-FLAC/ ---------------------------------------------- To do the actual file copy, remove the "--dry-run". I always prefer to verify what rsync does before risking the entire content of the hard drive. It works great. On the other hand, I'm worried about the mechanical wear on the USB connector and the stress on the hard drive. 2) rsync over Samba =================== My next solution was to mount on my PC the Touch hard drive over samba, and to rsync over the CIFS protocol. It does not work. The basic problem is that CIFS does not seem to manage properly the "modified time", which is what rsync uses. In other word, rsync was always seeing the modified time between the file as different, and wanted to re-upload everything to the Touch. 3) rsync on the Touch ===================== My final solution is to put rsync directly on the touch. There is a couple of gotchas, but it work great and I'm happy. The first thing is to cross compile rsync for the Touch. This involve building the development environment for the Touch and building the package (which is included in the development environment). Relevant URLs : http://wiki.slimdevices.com/index.php/SqueezeOS_Build_Instructions http://www.pokylinux.org/doc/poky-handbook.html First, you need a Linux system. My main system is Debian, so that's easy for me, other people can probably run Ubuntu from the CD or in a VM. Second, you need to install a bunch of packages. The URL above has a nice list, but the exact list unfortunately depends on your Linux distribution. The build process usually give enough clues to figure out which package is missing. After, we start building : ------------------------------------------- cd .../somewhere svn co http://svn.slimdevices.com/repos/jive/7.5/trunk/squeezeos/poky sudo sh -c 'echo "0" > /proc/sys/vm/mmap_min_addr' bash umask 000 cd poky source poky-init-build-env bitbake squeezeos-image ------------------------------------------- If you manage to get enough package, it should pass the initial checks , start to download various packages and build them. It will take time, so on the mean time you can rip a few CDs or do the groceries... In my case, it did not manage to go through the end and faild somewhere. It did not matter, though, as it did compile the cross compiler and glibc properly (which is more or less all you need). Now, let's build rsync and push it to the Touch. -------------------------- bitbake rsync cd build/tmp-jive/work/armv5te-none-linux-gnueabi/rsync-2.6.9-r0/image/ cd usr/bin/ scp rsync [email protected]:/tmp cd ../../etc scp rsyncd.conf [email protected]:/tmp --------------------------- Final step is to log in the Touch and install things properly. ----------------------- ssh [email protected] cd /tmp mv rsync /usr/bin/ mv rsyncd.conf /etc/ cd /root ln -s /media/sda1 . ----------------------- I've also customised the rsyncd.conf on the Touch, but it look like in my case it is ignored. So, just for reference, here is the content... ------------------------------- # /etc/rsyncd.conf # Minimal configuration file for rsync daemon # See rsync(1) and rsyncd.conf(5) man pages for help # This file is required by rsync --daemon pid file = /var/run/rsyncd.pid #use chroot = yes #read only = yes # Simple example for enabling your own local rsync server #[everything] # path = / # comment = Everything except /etc exposed # exclude = /etc [Music-FLAC] path = /root/sda1/Music-FLAC/ use chroot = no max connections = 1 auth users = root hosts allow = 192.168.1.6 secrets file = /etc/.rsync_sec read only = no # uid = root # gid = root ------------------------------- As I could not get rsynd.conf to do anything, initially I used the Touch as the rsync client and my Linux PC as the server. This of course assume that the /etc/rsyncd.conf on the Linux PC is properly configured. So, this is the command I run on the Touch : -------------------------------------------------------- rsync --modify-window=252201 -rtvO --delete --progress --stats -i --dry-run --include="*/" --include="*.flac" --include="*.FLAC" --include="albumartsmall.jpg" --exclude="*" [email protected]:'Music-FLAC/' /media/sda1/Music-FLAC/ -------------------------------------------------------- I hope you noticed that there was one more gotcha. My Linux PC and the Touch disagree on the way to treat the timezone, so all the file I copied when the hard drive was mounted on my PC are now 7h shifted in time (which is my timezone). So, I had to make the "modify-window" 7h and one second. This is far from ideal, but if you limit yourself to one rsync a day it should work. After a bit of trial and error, I managed to make the Touch work as a rsync server, despite rsyncd.conf being ignored. The trick is the symbolic link to /media/sda1 I made you create above. With that symlink, I can run rsync from my PC : -------------------------------------------------- rsync --modify-window=252201 -rtvO --delete --progress --stats -i --dry-run --include="*/" --include="*.flac" --include="*.FLAC" --include="albumartsmall.jpg" --exclude="*" ~music/Music-FLAC/ [email protected]:'sda1/Music-FLAC/' -------------------------------------------------- On my wireless link, the file transfer is fairly slow. The fact that it runs over a ssh encrypted tunnel probably does not help. But, as rsync is pretty smart about what it update, in most case it should tolerable. Have fun... Jean -- jean2 ------------------------------------------------------------------------ jean2's Profile: http://forums.slimdevices.com/member.php?userid=33946 View this thread: http://forums.slimdevices.com/showthread.php?t=81755 _______________________________________________ Touch mailing list [email protected] http://lists.slimdevices.com/mailman/listinfo/touch
