Moving /home to a LVM

Herta Van den Eynde herta.vandeneynde at gmail.com
Thu Dec 20 09:32:18 UTC 2007


On 20/12/2007, Sorin Srbu <sorin.srbu at orgfarm.uu.se> wrote:
> Sorin Srbu <> scribbled on Wednesday, December 19, 2007 10:44 PM:
>
> Basic steps (taken from our dept's support-kb). All steps done as root:
>
> 1. Inform user of plans to add new harddrive and tell them to backup anything
> important off of the particular computer should anything go seriously
> pearshaped.
>
> 2. Shutdown computer.
>
> 3. Install new hd.
>
> 4. Boot computer.
>
> 5. Set computer to runlevel 1 (single-user login), so that no users may log on
> while finishing the move.
>
> 6. Check /etc/sysconfig/hwconfig to find out what the hd is actually called.
> Should normally be "hdb".
>
> 7. Run "fdisk /dev/hdb" to prepare the new disk.
>
> 8. Press p to see a partition list.
>
> 9. Press n to create a new partition hdb1. Use primary, 1, 1 and the default
> settings.
>
> 10. Press w to write the partition data and stuff to disk.
>
> 11. Run "mkfs.ext3 /dev/hdb1" to format the partition.
>
> 12. Move the old /home to eg /home.bak, "mv /home /home.bak".
>
> 13. Create new /home, "mkdir /home".
>
> 14. Mount the new new hd to /home, "mount /dev/hdb1 /home".
>
> 15. Copy the data from /home.bak to /home, "cp -vrf /home.bak /home".
>
> 16. Edit /etc/fstab to automount /dev/hdb1 as /home at boot. Copy the deault
> settings; compare with other mounts in fstab.
>
> 17. Reboot.
>
> 18. Ensure the computer is running at runlevel 5 (multiuser with X).
>
> [19. Optional: Leave /home.bak in place until you see all is working as it
> should, after this you can delete it as appropriate.]
>
>
> HTH.
>
>
>
> > Joey Prestia <> scribbled on Wednesday, December 19, 2007 9:17 PM:
> >
> > I did this just the other day, although not using LVMs, just ragular
> > old-school partitioning - I find those confusing and difficult to tweak
> > later.
> >
> > I'll mail the steps I did in the morning thursday; am home now and don't
> > my notes here. It's not that difficult, unless you start from LVMs on
> > your old drive...
> >
> >
> >> I am out of room on my /home partition which is just ext3 and I am
> >> wanting to move it to a unpartitioned area which i plan on making a LVM
> >> and once the data is moved I want to make the old /home partition LVM
> >> also and join it to the new LVM that I am creating. What I am unsure of
> >> is how to move the data do I just tar it up and move it to the LVM and
> >> untar it add the new part to fstab and take the old part out? will I
> >> have to reboot? any Help greatly appreciated.
> >>
> >> Thanks Joey

I'd copy using "cp -pr /home.bak /home".  The -p option preserves
mode, ownership and permissions.

Kind regards,

Herta




More information about the redhat-list mailing list