Galaxy Tab 2 10.1 and Ubuntu file transfer

Recently I’ve got myself a Samsung Galaxy tab 2, a useful and well made device, easy to carry around.
Using Ubuntu on my pc I suddenly met an odd connection problem I never had with my android smartphone, the device cannot be accessed directly as storage, but only using mtp protocols. This means I’m having problems moving most files on the tablet.
Looks like in the latest 13.04 version Ubuntu has a new upgraded version of GVFS with MTP support embedded.
Even if you’re not using the 13.x version of ubuntu you can install a special PPA providing the upgraded GVFS, just follow these steps:

sudo add-apt-repository ppa:langdalepl/gvfs-mtp
sudo apt-get update

Then install gvfs

sudo apt-get install gvfs

or lunch update manager if you already have it installed on your system.

If you should face any problem you can purge the new PPA doing:

sudo ppa-purge ppa:langdalepl/gvfs-mtp

Out of space on a linux machine, how to

Sometimes happens a linux machine runs out of space, there are many reasons for it, external attacks, large uploaded files, misconfigured log files, ecc…Running out of space can sometimes lead to file corruption problems, so it’s a good idea addressing the problem as soon as possible. While on windows machines we have many graphic tools to find large files, in linux we have all we need inside our kernel, but as usual, as a good linux sysadmin you need some command line tool tips, or finding those large file to delete can be tricky.
First of all find which partition you need to inspect:
df
and move there positioning yourself on the root.
then take a look at your directories (and they subdir) size:
du -sk *|sort -n
You will have something like this:

0 misc
0 net
0 proc
0 selinux
0 sys
4 media
4 mnt
4 srv
16 lost+found
88 tmp
296 dev
1036 root
3028 opt
7744 bin
14280 sbin
22827 boot
27276 lib64
46896 etc
131836 lib
324124 var
2859540 usr
81246924 home

folders are sorted from smaller to bigger.
Look at the folders size and try to guess where you need to clean some space, usually a sys admin knows his servers and can find out oversized directories at the first glance. We’ll move into /home for a deeper inspection:
cd /home
let’s see the files:
ls -al
if we can’t find anything wrong we can type
du -sk *|sort -n
again and follow the subfolders for a deeper inspection until we find our large file/files to be deleted, issuing
rm -f
will delete the file
rm -rf
will delete a directory and its contenet, use the commands carefully.
Check with df again your partition usage until you can free out the needed space.

HIDDEN SPACE

Sometimes there’s a big difference between what the “df” command says and what “du-sk” returns, the reason is “df” returns the disk allocation, while “du” the file dimensions. You can check if there are deleted files issuing this command:
lsof |grep '(deleted)'
finding deleted files still used by other programs when deleted. They still use space but do not show up in the du command. As soon as you restart the system or stop the program they leave.

PREVENT THE PROBLEM FROM HAPPENING

You can use a simple script to prevent your disk from going full:


you can find some more info about the script here:
http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html
set up a cronjob:
crontab -e
press the insert key, then add this line:
*/5 * * * * path_to_script
then press ESC key
and type :wq then return key to save and exit.

The script will run every 5 minutes checking space on your partitions and sending an email to “ADMIN” address once the space will go lower then the percentage in “ALERT”.
Remember to setup ALERT, ADMIN and eventually EXCLUDE_LIST in the script.