I lost My "/home"

email.listen at googlemail.com email.listen at googlemail.com
Mon Sep 24 01:24:14 UTC 2007

Am So, 23. September 2007 00:25:11 schrieb jim barnes:
> On Saturday 22 September 2007 14:30:49 email.listen at googlemail.com wrote:
> > Hi Jim
> >
> > Am Sa, 22. September 2007 17:58:24 schrieb jim barnes:
> > > On Saturday 22 September 2007 07:57:54 Suhendri wrote:
> > > > Hi All..
> > > >
> > > > My Desktop was ubuntu-edgy installed. I've splitted my harddisk to 3
> > > > partitions, as /, /home and swap file.
> > >
> > > <snip>
> > >
> > > > Please help me how to solve my problem.... So i can get all of our
> > > > files on /home folder..
> > >
> > > I gather you repartitioned after installing to separate /home to its
> > > own partition? If so, I would proceed cautiously something like this:
> > >
> > > mount                         # to list present mount points
> > > sudo umount /home  # now you have access to your /home files, check!
> > > sudo mkdir /newhome        # because you can only have one /home at a
> > > time sudo mount /dev/xxxx /newhome  # using info from the mount command
> > > above sudo cp -a /home/* /newhome      # make sure directories match
> > > after copy!
> >
> > Shouldn't it be mv and not cp?
> I've gotten in the habit of copying, something gets borked along the way
> and you've still got your source files.
> > Or a:
> >  rm -r /home/*
> > is missing here, isn't it?
> >
> > > sudo umount /newhome
> > > sudo mount /dev/xxxx /home        # now /home is where is you want it
> >
> > You copied the files from /home/ to /newhome but you dindn't delete the
> > old files in /home/!
> As I understand, the old/home is now free disk space if needed, and will be
> overwritten in time.
Not if you only copy data from /home/* to /newhome :)
> I welcome any corrections if my logic needs adjusting!

The answer you gave is a typical 'pithole' and one of my nasty examples I like 
to have in tests. (asking for the result of deleting /boot/vmlinux* is 
another one)

- you copy files to a new home partition 
- don't delete the content of the old /home 
- mount the new partition to /home 
  (the one you mounted to /newhome in your example)
- this will not free the disk space and btw. has an irritating side effect:
  · you don't see the files left in the old /home directory anymore
  · and more irritationg you will not have more available diskspace for the
    partition where the old /home is placed
    (NB. We used this in the past to 'hide' data by doing so)

You may try the folowing example (e.g. with an USB-Stick)
- make a directory called /mnt/testdir
   sudo mkdir /mnt/testdir

- put a file into this directory:
   sudo touch /mnt/testdir/testfile

- check if this file exists:
   ls /mnt/testdir/testfile
  It will show:

- plug in an USB-Stick and check it's mount point:
  You will see a list of mounted partitions (devices) and the last line listed 
  is the usb-stick starting with:
   /dev/sdc1 on /media/USB DISK type vfat ... ... 
  We will need what is in the 1st, 3rd and 5th collumn later on
  (the /media directory says that it is a removable media)

- un-mount the usb-stick:
   sudo umount /dev/sdc1 

- mount the usb-stick to /mnt/testdir:
   sudo mount /dev/sdc1 -t vfat /mnt/testdir

And now the AHA-Effect!

- list the content of /mnt/testdir
  ls -al /mnt/testdir
  And, voilla, there is no file called testfile anymore!
  It's still there but 'covered' by the mounted usb-stick partition

- We will see this if we unmount the stick and list it's content:
   sudo umount /mnt/testdir
   ls -al /mnt/testdir
  And we see the file named testfile again!

This effect above is exactly what you will see after copying the /home/ 
content to /newhome and not deleting the content left in /home/!

All content which is left in the /home directory is 'covered' by the 
mounted /dev/xxxx 


More information about the ubuntu-users mailing list