1

I installed a new ubuntu but I didn't delete my home folder because I have essential data in it. but after reinstalling I have a new home folder and my previous home folder mounts as drive. how I can merge this drive or add to my previous home folder?

thanks

mchid
  • 42,315
  • 7
  • 94
  • 147
user1099913
  • 127
  • 1
  • 7
  • It is probably mounting as a separate partition rather than a separate drive which, I guess, coming from windows is the same thing (drive c: d: etc.). There are many benefits of having your home directory on a separate partition. Is there any *specific* reason you *don't* want this? – mchid Sep 27 '15 at 05:25
  • yes I mean partition. thank your for correction.. for example copying from old home partition to my new home folder takes long time also I need space for makeing image and backup from my ubuntu which is not possible to save image file on new home partition. – user1099913 Sep 27 '15 at 05:50

1 Answers1

2

To achieve that you will have to set which partition gets mounted as /home. That involves editing your /etc/fstab.

First make sure your present home folder is empty. Then find out what is the partition name of your home drive, use sudo fdisk -l for that. I am going to assume its /dev/sdaX for this post, replace it with yours.

Then find out its uuid

sudo blkid | grep /dev/sdaX

Take note of UUID and TYPE. Now open your fstab file for editing

gksudo gedit /etc/fstab

Fill in a new entry like this,

UUID=xxxxx  /home  ext4  rw,relatime,data=ordered   0 2

Replace xxxxx with your uuid and ext4 with your TYPE. You could change spaces between columns as you see fit. Reboot your linux and you're done!!

IMPORTANT NOTE! If you have a separate partition for /home already , you will have to remove its entry from /etc/fstab as you can't mount two drives to same folder.

David Foerster
  • 35,754
  • 55
  • 92
  • 145
H. Freeze
  • 511
  • 2
  • 9
  • tnx for your answer . is it neccessery to make my new home partition empty ? I have about 700 G content on it :) – user1099913 Sep 27 '15 at 05:55
  • Yes, since you are going to mount old home drive on it, it wont be accessible anymore. You could just merge its data with old home if you have free space there. There also exists an alternative that you could make a folder named like `old_home` and mount your old home drive there, that will work too. – H. Freeze Sep 27 '15 at 06:00
  • thank you I'll try to find an external hard drive and move my content there and try your first suggestion . I'll report the result .again tnx alot – user1099913 Sep 27 '15 at 06:06
  • @user1099913 I have updated my answer with new detail check it too. Btw do select my answer as solution if it helped you. Goodluck! – H. Freeze Sep 27 '15 at 06:09
  • oh . I made a bad mistake . I did backup from my new mounted partition and instead of my home folder and when I'v mounted new partition as home folder all of my contents in old home folder have removed :( . is there any way to recover them ? – user1099913 Sep 28 '15 at 09:58
  • @user1099913 If you have by chance mounted your drive to a non empty home directory, you will be able to access your old resident data by simply `unmounting` it, just remove `fstab` entry and reboot to do that. If you however deleted your data in home folder you will have to run some recovery software for it. You could try something like `foremost` or `photorec`. They do take time to check disk for deleted files and folder and not all data will be recoverable but you will be able to get most back. Goodluck – H. Freeze Sep 28 '15 at 10:20
  • tnx alot for you answer :) – user1099913 Sep 28 '15 at 11:07