Page 1 of 1

clean up duplicate /home dir

PostPosted: Sep 22nd, '14, 18:21
by rooman
I've just discovered that I managed to create/copy/materialise a /home directory in root, as well as the /home partition. This could explain many annoying things like incorrectly parametered apps and documents disappearing! Sounds so stupid I know but...there are many files and folders in both and I think it better to clean up and use only the /home partition where there is in any case much more space available. I thought of copying over data and leaving a link to the partition in root folder.

Is there a more correct way to do this? I want to clean up before cloning all to a newer bigger disk soon.

Re: clean up duplicate /home dir

PostPosted: Sep 22nd, '14, 18:43
by doktor5000
Could you please show the current situation? Like with the following commands (last needs to be run as root).
Code: Select all
ls -al /home
df /home
export LC_ALL=C; for i in $(ls /home); do echo $i; df /home/${i}; done
lsblk -fl

Re: clean up duplicate /home dir

PostPosted: Sep 23rd, '14, 21:11
by rooman
Code: Select all
@localhost ~]$ ls -al /home
total 16
drwxr-xr-x  4 root          root          4096 mar 23  2014 ./
drwxr-xr-x 21 root          root          4096 sep 23 20:56 ../
drwxr-xr-x 38 root          root          4096 mar 23  2014 aurelien/
drwxr-xr-x 64 famillequenet famillequenet 4096 sep 23 20:57 famillequenet/
[famillequenet@localhost ~]$ df /home
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/sdb7           18G     16G  722M  96% /
[famillequenet@localhost ~]$ su -
Mot de passe :
[root@localhost ~]# export LC_ALL=C; for i in $(ls /home); do echo $i; df /home/${i}; done
aurelien/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb7        18G   16G  722M  96% /
famillequenet/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb7        18G   16G  722M  96% /
[root@localhost ~]# lsblk -fl
NAME FSTYPE LABEL          UUID                                 MOUNTPOINT
sda                                                             
sda1 ntfs   Windows C disk 6EF4CA8AF4CA53CD                     /media/Windows_C_disk
sda2                                                           
sda3 ntfs   Win G disk     F2D4E67ED4E64507                     /media/Win_G_disk
sda5 ntfs   win e disk     36C0A0D6C0A09E1D                     /media/win_e_disk
sda6 ntfs   win_h_disk     92CEBD10CEBCED9B                     
sdb                                                             
sdb1 ext3                  b4157870-0215-4c4c-a1f9-11e45473775d
sdb2                                                           
sdb5 swap                  e85192e6-e8d7-41da-8224-c38d033f3b63 [SWAP]
sdb6 ext2   data           33a3a149-fc67-46e9-a05c-4fac5fa9d3cd /data
sdb7 ext2   /              60a430f7-32e1-45fa-87a8-b2f75f89da3c /
sdb8 ext2   /home          d5ac8f32-e14b-4e5c-ab9b-fd3c01765fe1
sdd                                                             
sdd1 vfat                  3261-3763                           
sr0                                                             
[root@localhost ~]#


any more info needed? Tks for interest.

Re: clean up duplicate /home dir

PostPosted: Sep 23rd, '14, 22:08
by doktor5000
Not sure. I can see you have a separate /home partition which is only ext2 filesystem (?) and not mounted currently
Code: Select all
NAME FSTYPE LABEL          UUID                                 MOUNTPOINT
sdb8 ext2   /home          d5ac8f32-e14b-4e5c-ab9b-fd3c01765fe1


And the current directories in your /home folder are in use, and located in the root partition.

So what you need to do is probably:

- find out why your sdb8 home partition is not mounted
- create a backup with the current contents from /home
- mount your home partition
- restore the backup to the home partition, after making sure there are no files inside there that you still need

For the first point, please show your /etc/fstab
Code: Select all
cat /etc/fstab

Re: clean up duplicate /home dir

PostPosted: Sep 24th, '14, 22:11
by rooman
I probably just botched up a re-install after a system crash & destroy. If I try to re-mount the /home partition I'm asked if I want to hide or wipe over data, no problem, I can save then restore personal stuff.
Code: Select all
cat /etc/fstab
# Entry for /dev/sdb7 :
UUID=60a430f7-32e1-45fa-87a8-b2f75f89da3c / ext2 relatime,acl 1 1
# Entry for /dev/sdb6 :
UUID=33a3a149-fc67-46e9-a05c-4fac5fa9d3cd /data ext2 defaults 1 2
# Entry for /dev/sda3 :
UUID=F2D4E67ED4E64507 /media/Win_G_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda1 :
UUID=6EF4CA8AF4CA53CD /media/Windows_C_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda5 :
UUID=36C0A0D6C0A09E1D /media/win_e_disk ntfs-3g defaults,umask=000 0 0
none /proc proc defaults 0 0
# Entry for /dev/sda1 :
#UUID=6EF4CA8AF4CA53CD /media/win_c ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda5 :
#LABEL=win_e_disk /media/win_e_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda3 :
#LABEL=Win_G_disk /media/win_g_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda6 :
#UUID=2873-6BFE /media/win_h_disk vfat defaults,umask=000 0 0
#none /proc proc defaults 0 0
# Entry for /dev/sda5 :
#UUID=36C0A0D6C0A09E1D /media/win_d ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda6 :
#UUID=2873-6BFE /media/win_e vfat umask=000,iocharset=utf8 0 0
# Entry for /dev/sda2 :
#UUID=E8B4-B5FA /media/win_f vfat umask=000,iocharset=utf8 0 0
# Entry for /dev/sda4 :
#UUID=F2D4E67ED4E64507 /media/win_g ntfs-3g defaults,umask=000 0 0
#none /proc proc defaults 0 0
# Entry for /dev/sdb5 :
UUID=e85192e6-e8d7-41da-8224-c38d033f3b63 swap swap defaults 0 0

One of my worries is to be sure that the system realizes where I want to use /home ie: this partition and no longer the /root/home folder. You seem to think that it can be done easily...

Re: clean up duplicate /home dir

PostPosted: Sep 25th, '14, 08:17
by doktor5000
rooman wrote:If I try to re-mount the /home partition I'm asked if I want to hide or wipe over data, no problem, I can save then restore personal stuff.

So you tried this during runtime, using diskdrake? http://doc.mageia.org/mcc/4/en/content/drakdisk.html
Yes in that case it will ask you if you just want to overmount the current contents of /home folder with your home partition, or if you want to transfer the data into the new home partition. But I've got no experience with that, I suggest doing a manual backup via e.g.

Code: Select all
tar -cpszf home_backup_$(date +"%Y%m%d").tar.gz /home/famillequenet /home/aurelien

as root in a location where you have enough room to hold the backup, maybe in your /data partition.

But first something more important. Due to the reinstallation, you've ended up with a lot of duplicate entries for windows partitions, each of the entries below exists twice, with different mountpoints. You should remove those that begin with #LABEL= and the # comment above that line. But most of those entries are commented out at the moment, so no urgent problem.
Code: Select all
cat /etc/fstab
# Entry for /dev/sda3 :
UUID=F2D4E67ED4E64507 /media/Win_G_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda1 :
UUID=6EF4CA8AF4CA53CD /media/Windows_C_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda5 :
UUID=36C0A0D6C0A09E1D /media/win_e_disk ntfs-3g defaults,umask=000 0 0
none /proc proc defaults 0 0
# Entry for /dev/sda1 :
#UUID=6EF4CA8AF4CA53CD /media/win_c ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda5 :
#LABEL=win_e_disk /media/win_e_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda3 :
#LABEL=Win_G_disk /media/win_g_disk ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda6 :
#UUID=2873-6BFE /media/win_h_disk vfat defaults,umask=000 0 0
#none /proc proc defaults 0 0
# Entry for /dev/sda5 :
#UUID=36C0A0D6C0A09E1D /media/win_d ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda6 :
#UUID=2873-6BFE /media/win_e vfat umask=000,iocharset=utf8 0 0

rooman wrote:One of my worries is to be sure that the system realizes where I want to use /home ie: this partition and no longer the /root/home folder. You seem to think that it can be done easily...

That is easy, after you have added an entry in /etc/fstab for your home partition it will get automatically mounted. And yes it can be done easily :)