Update Banshee’s internal audio file URIs after moving
28. August 2010
After moving the audio library to another place, the internal URIs of music known to Banshee has to be updated. There is no perfect way implemented into banshee. But maybe the “Rescan Music Library” works for you. If not, it’s easy to update its database because great sqlite3 is used.
# necessary tool installed? sudo apt-get install sqlite3 # change to config dir and backup cd ~/.config/banshee-1 cp banshee.db banshee.db.backup # dump track entrys to sql file sqlite3 banshee.db > .output CoreTracks.sql > .dump CoreTracks > .quit # update sql file sed 's,file:///old/and/much/too-long/path/to/music/,file:///new/path/music/,' < CoreTracks.sql > NewCoreTracks.sql # change db sqlite3 banshee.db > DROP TABLE "CoreTracks"; > .read NewCoreTracks.sql > .quit
Don’t forget to update the banshee preferences to the new path.
Undelete eCryptfs encrypted files
5. January 2010
This is on how i recovered most of a bunch acidentially deleted files. With that method i was able to restore around 70% of the files although the notebook was in use three more times before recovering.
Lessions learned
find -delete -name Thumbs.db find -name Thumbs.db -delete
These two commands are not the same. The first deletes all the files down the current directory, the latter only Thumbs.db. I don’t guarantee for anything. This also applies to what will (not) happen if you follow these steps:
Understanding
This happened on a quite fresh installed Ubuntu 9.10 where I chose ext4 for the underlying filesystem and to encrypt my home folder at the installer. From the eCryptfs launchpad page: “eCryptfs is a POSIX-compliant enterprise-class stacked cryptographic filesystem for Linux.” Well, that did not give my any ideas how to recover the files. What you have to know: Every file is encrypted by itself. If you recover the file on the lower filesystem, you will most likely be able to access it again.
Recovery
Stop using the filesystem. (umount or shutdown)
But wait! Two things are useful:
(1) On which device is the filesystem mounted? type mount
(2) Whats the time when it happened? type date +%s (seconds since the epoch)
The next steps can be most easily achieved with a Ubuntu Live Session and large USB drive or other kind of internal space. There is no need to make an image of the filesystem: we won’t modify it. We will use extundelete and recover all deleted files to a different medium. Then, we can copy the “RECOVERED_FILES” folder right below the mounted eCryptfs where we can automatically view all files (and directory names).
At the Live CD session:
# change to location with much space cd /media/disk # compile extundelete wget http://downloads.sourceforge.net/project/extundelete/extundelete/0.1.8/extundelete-0.1.8.tar.bz2 apt-get install e2fsprogs e2fslibs e2fslibs-dev g++ tar xfvj extundelete-0.1.8.tar.bz2 cd extundelete-0.1.8/src make # recover files cd ../.. extundelete-0.1.8/src/extundelete --restore-all /dev/sda1 # replace sda1, see (1)
Adding “–after 123456789” could be useful, see (2). If you are desperate, do not use it because it could restrict too much, e.g. files that don’t have a timestamp any more. Same for “–restore-files /home/.ecryptfs/username/.Private”.
Back to the system
Now you can reboot into or mount your system again. Copying the RECOVERED_FILES folder to ~/.Private or /home/.ecryptfs/username/.Private (the 2nd is just a link to the first) will make you see it in your user’s home.
An alternative is something like:
cd /home/.ecryptfs/username/.Private mkdir RECOVERED_FILES mount --bind /media/disk/RECOVERED_FILES RECOVERED_FILES
A tiny amount of files having crazy names of logfiles or similar were spread over the filesystem.
find is your friend. (if you use it right)
find / -size +2M -size -6M # photos? find / -size +500M # movies?
Good luck.
Update
There is a new version of extundelete. Maybe, you’d like to choose a more up to date version from the extundelete sourceforge page. Also, there’s another guy who had fun deleting his files: rm -rf ext4+ecryptfs Undelete on Wikinewbie’s Blog.
