Tuesday, May 9, 2017

Mount /home dir to new partition or hdd

After installing Kali, Need to found user home directory on other hdd. 
--------------------------------------------------------------------
{
        1. Find uuid of the hdd or partition
         {
                  #blkid
                         // will display blkid and type =ext3
          }
        
        2. setup fstab
  {
  //copy fstab as backup, incase if you need again
  #cp /etc/fstab /etc/fstab.$(date +%d-%m-%Y)
 
  //cmp the two files
  #cmp /etc/fstab /etc/fstab.$(date +%d-%m-%Y)
 
  //edit with vi
  #vi /etc/fstab
  {
  (hdd id) location type
  UUID=1112255555554 /media/home ext4 defaults 0 2
  }
 
  //create a tmp dir for cp data --> the location tab in fstab file above
  #mkdir /media/home
 
  //remount fstab
  #mount -a
  }
 
  3. cp /home dir to new partition
  {
  rsync -aXS --progress /home/. /media/home/.
  }
 
  4. check cp work
  {
  #diff -r /media/home /home
  }
 
  5. final change
  {
  //edit with vi --> replace /media/home to /home
  #vi /etc/fstab
  {
  (hdd id) location type
  UUID=1112255555554 /home ext4 defaults 0 2
  }
  }
 
  6. if error
  {
  #umount /media/home
  #mount -a
  }
 
  7. del old home
  {
  $rm -rI /old_home
  }
 


}

No comments:

Post a Comment