Author Topic: *SOLVED* Moving /home to new partition  (Read 867 times)

0 Members and 1 Guest are viewing this topic.

Offline chemicalfan

  • Hero Member
  • *****
  • Posts: 656
  • Karma: 25
  • Gender: Male
  • I've been here a little while!
    • View Profile
    • Awards
*SOLVED* Moving /home to new partition
« on: December 03, 2013, 01:11:30 pm »
On my desktop rig, I'm dual-booting Mint 15 & Windows Vista, with GRUB on the MBR of sda (Mint is on sdb, with a NTFS data partition also on the disc). Vista was first (many years prior), and I installed Mint in the summer to get round a problem with Steam (multiple users just doesn't work on Windows). Anyway, as this was done quickly, I just went with one primary partition for Mint, mounting / only. I'm regretting this now, as Mint 15's support will run out before Mint 17 LTS comes out. So, rather than run unsupported for 5 months, and in the spirit of "do it sooner rather than later", I want to repartition the drive to add another primary partition, so that I can mount /home on it, thus allowing me to re-install without losing the /home partition (and the 20Gb of Steam downloads).

My question, is once I've done the easy part and repartitioned the drive, how do I move /home to the new partition? What is the procedure, other than using a liveCD to move the data then updating fstab?
« Last Edit: December 05, 2013, 04:50:34 pm by chemicalfan »

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13594
  • Karma: 339
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Moving /home to new partition
« Reply #1 on: December 03, 2013, 06:04:55 pm »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline chemicalfan

  • Hero Member
  • *****
  • Posts: 656
  • Karma: 25
  • Gender: Male
  • I've been here a little while!
    • View Profile
    • Awards
Re: Moving /home to new partition
« Reply #2 on: December 04, 2013, 01:39:54 pm »
Nice one, a few more steps than I thought but not overly complicated. Seems to suggest that it's more easily done "live" rather than rebooting into a LiveCD.... Not sure I'm too keen to work on it while it's mounted, but the process is easy to follow so I'll just trust it :)

Got a side issue with disc capacity (as it's a copy, rather than an in-place switch), as I'll need double the disc space, and the disc is currently fully partitioned. Worse, my / partition will have 20Gb free on it after all is done, and shrinking it may not work (and, unless I can move the new /home partition, will leave a big unpartitioned hole in the drive)

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13594
  • Karma: 339
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Moving /home to new partition
« Reply #3 on: December 04, 2013, 03:18:16 pm »
OK, you're loosing me here .. where exactly do you want to move /home from an to ?

Something else that jumps out .. why are you paranoid about running unsupported for 5 months, I certainly wouldn't be .. there will only be a couple of "security" fixes, and those are HIGHLY unlikely to have exploits in the wild.

I'd be more paranoid on a server, but not on a desktop .. hell Mint doesn't apply half the Ubuntu updates by default anyway, there was a big hoohaa about that recently with an Ubuntu dev stating Mint "isn't safe for online banking" because of its update policy .. but I'd still trust it MUCH more than Windows with the latest AV.
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline chemicalfan

  • Hero Member
  • *****
  • Posts: 656
  • Karma: 25
  • Gender: Male
  • I've been here a little while!
    • View Profile
    • Awards
Re: Moving /home to new partition
« Reply #4 on: December 04, 2013, 04:49:33 pm »
I'm not that paranoid about running unsupported (it's really only the web browser, and I could always "backport" it myself from source), but I'll have to do this when Mint 17 comes out anyway. At the moment, I just have my entire Mint install on 1 partition, but I want it on 2 (one for / and one for /home) to allow an in-place upgrade/install. But I need it in-place, as the entire disc is partitioned so there's no space to make the copy.

I'm thinking about a backup/delete/restore - backup /home folder externally (maybe NTFS drive?), delete it & re-partition, then restore it onto the new partition & update fstab. Thoughts?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13594
  • Karma: 339
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Moving /home to new partition
« Reply #5 on: December 04, 2013, 05:03:55 pm »
I'm still trying to understand your "hole in the middle of the drive" statement ??

How I see it ..

you shrink your current Mint partition .. create a new partition .. rsync the contents of /home to the new new partition .. adjust fstab to mount the new partition as /home .. rename the old /home to /home-old .. create a new /home mountpoint .. sudo mount -a to mount the new partition as /home .. check everything works .. delete /home-old

--
« Last Edit: December 04, 2013, 05:06:13 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline chemicalfan

  • Hero Member
  • *****
  • Posts: 656
  • Karma: 25
  • Gender: Male
  • I've been here a little while!
    • View Profile
    • Awards
Re: Moving /home to new partition
« Reply #6 on: December 04, 2013, 05:09:53 pm »
Yeah, I get the process, but I don't believe I'll be able to shrink the Mint partition, as I'd need the same amount of free space as the /home currently occupies, not counting fragmentation. I don't have it, the partition is pretty full, which isn't normally a problem :(

Edit: Also, I thought Mint drew from Ubuntu's repos directly? I'll have to have a look at my sources later!
« Last Edit: December 04, 2013, 05:11:36 pm by chemicalfan »

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13594
  • Karma: 339
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Moving /home to new partition
« Reply #7 on: December 04, 2013, 05:19:05 pm »
OK

do it twice .. once to the external drive .. then after adjusting the partitions, move it again to the freshly created partition.

Once you've rsynced it to the external HDD you effectively have a backup so you'd have to do sommat really dumb to not be able to recover ;)

Or is that what you meant ?
« Last Edit: December 04, 2013, 05:32:43 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline SeZo

  • Hero Member
  • *****
  • Posts: 1505
  • Karma: 119
  • Gender: Male
    • View Profile
    • Awards
Re: Moving /home to new partition
« Reply #8 on: December 04, 2013, 08:45:54 pm »
I am always for the simplest solution. I would tackle it the opposite way:
From a Live CD:
Create a smaller root partition (say 20 gb)
Copy everything from the existing Mint partition (except /home folder) into the newly created partition.
Delete everything except the /home folder in the Mint partition
Move your <username> folder to the root of the Mint partition then delete the /home directory.
In the newly created root partition create a /home folder
Edit the fstab to point to the correct partitions
Update grub and then reboot (and keep your fingers crossed) to your new setup
« Last Edit: December 04, 2013, 08:49:21 pm by SeZo »

Offline chemicalfan

  • Hero Member
  • *****
  • Posts: 656
  • Karma: 25
  • Gender: Male
  • I've been here a little while!
    • View Profile
    • Awards
Re: Moving /home to new partition
« Reply #9 on: December 05, 2013, 09:57:44 am »
OK

do it twice .. once to the external drive .. then after adjusting the partitions, move it again to the freshly created partition.

Once you've rsynced it to the external HDD you effectively have a backup so you'd have to do sommat really dumb to not be able to recover ;)

Or is that what you meant ?

Yeah, that looks like what I was planning. Does rsync use some kind of shadow copy, or doesn't it really matter that the partition is mounted (not like Windows, where there is constant I/O for no apparent reason)?

I am always for the simplest solution. I would tackle it the opposite way:
From a Live CD:
Create a smaller root partition (say 20 gb)
....

This is the bit I can't do - can't create something out of nothing. I have no unpartitioned space - I'd have to shrink the existing NTFS partition, create the new one, then at the end delete the old one and grow the NTFS back again. And I don't trust NTFS that much.

I think I'll end up backing up the /home folder, then wiping the entire partition, then installing Mint 17 into it, but this time re-partition the Linux partition into 2. Then restore the /home folder over the top of the new one on the seperate partition (using a LiveCD, so that it's not in use). I guess there's a risk of using a Mint 15 /home with Mint 17, but I guess I could just sync the Steam folder, as that's the main worry...

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13594
  • Karma: 339
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: Moving /home to new partition
« Reply #10 on: December 05, 2013, 01:55:54 pm »
I *guess* it can do something similar to "shadow copy" as it copied my home folder perfectly .. and I had some stuff open.
(if that's what you mean ?)

Obviosly you'd want to ommit the .gvfs folder if you have anything else mounted through it at the time .. but that's all in the Ubuntu tutorial, including how to compare the backup for differences :)

--
« Last Edit: December 05, 2013, 01:57:59 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

Offline chemicalfan

  • Hero Member
  • *****
  • Posts: 656
  • Karma: 25
  • Gender: Male
  • I've been here a little while!
    • View Profile
    • Awards
Re: Moving /home to new partition
« Reply #11 on: December 05, 2013, 04:50:09 pm »
Yeah, I think I've got it sorted in my head :)

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 13594
  • Karma: 339
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: *SOLVED* Moving /home to new partition
« Reply #12 on: December 05, 2013, 06:44:50 pm »
Thanks for marking it solved :)
WARNING: You are logged into reality as 'root'

logging in as 'insane' is the only safe option.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal