Sshfs worked great for deleting old backup


#1

I was using rsync to back up “My Documents” on a windows XP machine through a samba mount to a ubuntu machine for a while when I was moving to a new office and didn’t a backup to another building available. Today I was looking at my DH account to see where I could free up some disk usage and kind of rediscovered this backup account. I decided to delete the whole backup, since it’s out of date. However, my windows FTP clients hit permissions problems when trying to delete some folders. I’d get a string of messages that I wasn’t owner, permissions not sufficient, and directory not empty. For instance, My Music was filled up with stuff that my user either didn’t own, or file names that were hard for programs and systems to recognise, or were set read-only.

I could use ftp from a command line and cd to a troublesome folder, run chmod from the ftp connection, then delete the file, but in ftp apparently there’s not recursive option. There were too many files and folders for that. On the other hand, the backup accounts on DH are ftp only, so I couldn’t ssh into the account and go wild with chmod -R and rm -r.

Somehow I stumbled on to sshfs. This utility makes file system mounts through sftp commands to another system. (Am I correct?)

First I had to install it on my Ubuntu machine with sudo apt-get install sshfs

Then I made a mount point and made myself owner:

mkdir ./sshmount chown paul ./sshmount
Then made the mount to DH’s backup server, where bxxxxx is my backup account user on DH:

Then my backup folders appeared as subfolders to my just created mount point. Then there were only two more terminal commands in on my Ubuntu machine to delete all those troublesome folders and subfolders in pauldocs on hanjin:

cd ./sshmount chmod -R 777 ./pauldocs rm -r pauldocs

Well, three if you count the cd. And quickly, 32 GB of disk space was freed up. I didn’t try to delete from the Nautilus file system browser, but the mount and contents show up in Nautilus.