Oops! Just wiped out half my home :)

Hi there, first post here. I try to solve things on my own as much as I can but during the process of setting up a cron job on my shared server, I’ve managed to wipe out half of my home!

Let’s say that my username is patrick and my shared server is fili. That means I log in as patrick@fili.dreamhost.com

Using filezilla, before I stuffed things up, I’d see, from memory something like…

(and others I can’t remember)

After my error, I’m down to just /.ssh, logs, Maildir and a few others.

Two questions I’m hoping I can get answered…

Q1. - How can I get those critical “standard” directories back?

Q2 - How can I avoid repeating the error? (What I was trying to do.)

I was trying to rsync data from my VPS on Digitial Ocean to my shared server at Dreamhost. (That took some days for someone like me who has no formal sysadmin training!)

When I tried to put it into the dreamhost cronjob, I kept getting errors and so kept altering the command below (pasted into the “Goodies” cron job section on the dreamhost panel):

rsync -abzrPRv --delete --backup-dir=/digi_changed_files --suffix=_date +%F-%H%M --exclude=backup -e ssh root@188.XXX.XXX.XXX:/data_on_dreamhost ~/

I must have run 50 variations of the above but the --backup-dir=digi_changed_files never seemed to work and so at one point, I ran the command…

rsync -abzrPRv --delete --backup-dir=~/digi_changed_files --suffix=_date +%F-%H%M --exclude=backup -e ssh root@188.XXX.XXX.XXX:/data_on_dreamhost ~/

This created the following…oops

I shelled in via puTTy, went to my home (or root directory?), typed ‘ls’ to make sure that ~ appeared alongside the “standard” directories and then then typed, with fear, the following…

rm -rf ~

I hope you’ll at least get a laugh from the above :slight_smile:
However, this is really hard stuff for me and I’m not only dealing with this but two linux servers, phpBB, css and so on. (I’m not going to even mention Microsoft!)

Hope someone can help,

You deleted your home directory with that command: the character ~ is special and represents your default home folder for the shell.

This didn’t work because you provided an absolute path, where your user doesn’t have permission to write. Remove the / at the beginning and it should work.

Now… to recover from the mistake you have two possible paths: if your home folder is not completely wiped (it seems like it’s not), then restart the rsync. I believe that some crucial folders have not been removed as DreamHost automatic system manage them for you. Maybe you don’t need anything else but if things don’t work correctly, you’ll need to open a ticket with DreamHost Support.

If you don’t have time or have no interest in learning this stuff, try contacting DreamHost Support and see if they have a backup they can restore for you.

And don’t worry: these things happen, they’re all part of the learning process :slight_smile:

1 Like

Thank you @smaffulli :wink:

I must admit I was pretty surprised to see that new ~ folder created. I’ve never seen that before!

Prior to seeing your message, I created a new ssh user, let’s call it patrickoops@filidreamhost.com.
When I filezilla into that, I see…
But, in light of your reply, that’s probably not the way to go.

I did notice before I stopped the rm -rf ~ command that it threw up something like “not allowed,” so I think the basics are probably still there. I currently use my dreamhost account now mainly for backing up and testing. It looks like I might have lost some of my old backups.

I’ll give Dreamhost Support a go now.

I do have one more question for you but will wait until I know how to write it properly.

Thanks again Stefano :v:

1 Like

Dreamhost Support got back to me with a very friendly email. I’d never noticed before but they do hold backups for data held under any hosted domain folders. Cool!

The data I lost was under other folders but they were mainly backups so no major problem.

Only problem I have left now is trying to work out what command to use to get rid of that extra “~” folder (which is empty). From my root, I tried the following with no luck…


I certainly don’t want to do “rm -rf ~” again :open_mouth:

Got it! This worked…

rm -rf /home/dhusername/~

:v: Thanks again for your help @smafulli

1 Like