Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: created new partition for /home, having trouble moving data

  1. #1

    Default created new partition for /home, having trouble moving data

    Hello,

    I have an opensuse 13.2 install that was set up with /home on the root partition. I am using this more now and would like to move home to a new and larger partition. I have created the ext4 partition and now need to move the data from the current home partition.

    My plan was to move the data and then use Yast2 to change the mount point of the new partition to /home. I can mount the new partition in dolphin, but if I do that I don't have permission to write to it. I have tried adding my user to the partition with full permissions, but that doesn't do anything. The partition seems to be owned by root. I could probably move everything off of the current home directory to some other location, but is seems as if I should be able to mount a new partition and write to it without too much difficulty.

    Any suggestions? Will simply changing the mount point of the new partition to /home make it my new /home location?

    Thanks,

    LMHmedchem

  2. #2

    Default Re: created new partition for /home, having trouble moving data

    I forgot to mention that I tried the simple,
    Code:
    sudo mount /dev/sda5/  /home/user_name
    That didn't do anything but bork all of my desktop icons. Restarting seemed to fix this. I guess I should mount it somewhere else but I would appreciate some advice before I really mess things up here.

    Sorry, for the double post but I couldn't see how to edit my earlier post.

    LMHmedchem

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,183
    Blog Entries
    3

    Default Re: created new partition for /home, having trouble moving data

    When I have done something similar, I have just modified "/etc/fstab" so that it would be mounted at "/home" on the next boot. And then I reboot.

    If something goes wrong, you can boot to a rescue CD or DVD or USB, and undo the editing.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,772

    Default Re: created new partition for /home, having trouble moving data

    I do not think you want it at /home/user_name, but in the end you want it at /home.

    Temporary you can mount on /mnt, so you can do the data transfer.

    You talk about Dolphin, but Dolphin has no task here. None of the users using /home may be logged in during the datatransfer. Only root must be logged in (after all someone must do the transfer), but of course NOT in the GUI.

    I have to do something else now. When you like a plan I can post one after about 1 and a half hour.
    Henk van Velden

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,772

    Default Re: created new partition for /home, having trouble moving data

    A plan.

    1. All users should be logged out.
    2. Go to the console (Ctrl-Alt-F1 or use run level 1) and log in as root.
    3. Code:
      mount /dev/sda5 /mnt
    4. Copy the data. I use a rather old fashioned way
      Code:
      cd /home
      Code:
      tar cf - * | '{cd /mnt ; tar xvf - ; } '
      Take care here, all white space shown here must be copied! (someone may post here an easier cp command that keeps ownership, etc.)
    5. You can do a short check to see if everything in /mnt looks complete, owned by the correct user, etc.
    6. Code:
      umount /mnt
    7. make an entry in /etc/fstab
      Code:
      /dev/sda5  /home           ext4   defaults              1  2
    8. Code:
      mount -a
    9. Now users should be able to log in and check if anything changed.


    There is however one more thing to do after users give you their OK. All the data is still on the root file system and when you want to recover that space (understand that until now you did not destroy anything in the old home directories, you can still go back to the old situation):
    1. Again, all user should log out and root logs in at the console.
    2. Code:
      umount /home
      Code:
      cd /home
      Code:
      rm -rf *
      Code:
      cd
      Code:
      mount -a
    3. All clear.


    One word about the /etc/fstab entry. You might want not to use /dev/sda5, but e.g. UUID=..... . That is up to you.

    And of course: When in doubt, ask here first.
    Henk van Velden

  6. #6
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    20,308
    Blog Entries
    14

    Default Re: created new partition for /home, having trouble moving data

    My 2 cents: Backup /home, install Leap 15.1 . 13.2 has been past its EOL for years now.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  7. #7

    Default Re: created new partition for /home, having trouble moving data

    I just did something like that a week ago. The runlevel change I did but I used rsync

    Code:
    rsync -avxz /source /destination
    and edited /etc/fstab to reflect the changes like hcv did but I did not deleted the old home before I can confirm that everything is working on my new home.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,849
    Blog Entries
    2

    Default Re: created new partition for /home, having trouble moving data

    Quote Originally Posted by LMHmedchem View Post
    <snip>

    Any suggestions? Will simply changing the mount point of the new partition to /home make it my new /home location?

    Thanks,

    LMHmedchem
    Absolutely yes,
    This will work especially if using the YaST Partition editor.

    I've done that... simply go into where /home is defined and point it at something else.
    Then, save and reboot.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  9. #9

    Default Re: created new partition for /home, having trouble moving data

    Quote Originally Posted by hcvv View Post
    A plan.
    Thank you for taking the time to write this out. That was kind of you.

    I implemented the steps a bit differently.

    - log out of user and into root
    - make a landing space for the mounted drive,
    Code:
    mkdir /mnt/suse_data
    - mount the new partition to receive the copy of /home,
    Code:
    mount /dev/sda5 /mnt/suse_data
    - copy the data, I use the following,
    Code:
    cp -Rfp /home /mnt/suse_data/ 2>&1 | tee -a copylog.txt
    This gives me a log file that will show if there were any issues in making the copy.

    - point /home to the new partition
    Code:
    open yast partitioner and select the current /home to not be mounted
    close the partitioner
    open yast partitioner again and select the new partition to be mounted at /home
    I did use the UUID to mount since I agree that this is more reliable
    - restart

    It would have been simpler to edit /etc/fstab directly but I didn't have the UUID for sda5 copied anywhere and I thought that the GUI would be dependable.

    This did what I needed. I now have a new, larger, home partition with all of my data. Looking back on your notes, I think that I neglected to delete the old copy of the data in /home. I will have to see if I can find where that data is living at the moment. I assume if I am root I will be able to find it.

    LMHmedchem

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,772

    Default Re: created new partition for /home, having trouble moving data

    Quote Originally Posted by LMHmedchem View Post
    Thank you for taking the time to write this out. That was kind of you.

    I implemented the steps a bit differently.

    - log out of user and into root
    - make a landing space for the mounted drive,
    Code:
    mkdir /mnt/suse_data
    - mount the new partition to receive the copy of /home,
    Code:
    mount /dev/sda5 /mnt/suse_data
    - copy the data, I use the following,
    Code:
    cp -Rfp /home /mnt/suse_data/ 2>&1 | tee -a copylog.txt
    This gives me a log file that will show if there were any issues in making the copy.

    - point /home to the new partition
    Code:
    open yast partitioner and select the current /home to not be mounted
    close the partitioner
    open yast partitioner again and select the new partition to be mounted at /home
    I did use the UUID to mount since I agree that this is more reliable
    - restart

    It would have been simpler to edit /etc/fstab directly but I didn't have the UUID for sda5 copied anywhere and I thought that the GUI would be dependable.

    This did what I needed. I now have a new, larger, home partition with all of my data. Looking back on your notes, I think that I neglected to delete the old copy of the data in /home. I will have to see if I can find where that data is living at the moment. I assume if I am root I will be able to find it.

    LMHmedchem
    Looks as if you did quite well, Of course, when you do understand what the steps do and why they are suggested in the way they are suggested, you can deviate on them.

    One thiing that worries me (may be due to your short descriptions) is that you simply say you logged in as root without stressing that you did that NOT in the GUI. Also that when you say you use YaST, that that is NOT from a GUI (because no normal user should be logged in when you tinker with /home and user root should NEVER log in in the GUI), but from a console login (and thus YaST using ncurses). This specialy for those that come and read this thread to repeat the procedure on their own system.

    About cleaning up the old data (and thus creating free space on your / file system). When you do a
    Code:
    df
    you will notice that your / file system is as full as it was before. You did not delete all the data in /home that was there all the time. You can not reach that data as long as your new /home file system is mounted on /home. Noody can, not even root, because nobody can see it. It is hidden behind your mounted /home file system. Thus to delete the old data you must use root from the console with no users loged in and then delete. As I described above.
    Henk van Velden

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •