[ec2] error when moving Home folder to persistent EBS

Jim Cheetham jim at inode.co.nz
Wed May 13 09:41:13 BST 2009


On Wed, May 13, 2009 at 8:22 PM, Pedro Sanchez Pernia
<pedrosanchezpernia at gmail.com> wrote:
> sudo mkdir /persistent/home
> sudo mv /home/ubuntu /persistent/home/ubuntu
> sudo ln -s /persistent/home/ubuntu /home/ubuntu
>
> Issue #1 : sudo: cannot get working directory (after ln)
> Issue #2 : because home/ubuntu and all the grant files has been moved, if I
> loose the connection, I can no more SSH the server and I have to launch a
> new instance ...

I think it's just you and the shell, and nothing EC2-specific :-) I
guess that you were in /home/ubuntu when you did step 2 and moved it.
This will result in your shell's current working directory being
nonexistant, and will also mean that references to $HOME will fail
(and if I remember correctly, sudo looks in $HOME) -- even if there is
another directory with the same name. You can refresh the current
location with the wonderful "cd $(pwd)".

Probably a better sequence would be to start a root shell with sudo
and use that :-

$ sudo -i
# mkdir /persistent/home
# mv /home/ubuntu /persistent/home/ubuntu
# ln -s /persistent/home/ubuntu /home/ubuntu
# exit
$ cd $(pwd)

(Note that I've just typed these commands in, don't copy/paste them)

-jim



More information about the Ec2 mailing list