moving /home [Solved - Corrected HowTo]
mafia_rgd at mail.ru
Mon Dec 5 19:41:32 UTC 2005
This is a prolix but a valid step-by-step instruction. You may want to publish
it in a faq.
One note: your command 'cp -a/home/* /mnt/mynewhome' would not copy
the /home/.* entries. I don't really think there are chances such entries
exist, however having such a job to do you've got to ensure.
I've written a similar instruction, without any comments though. However
reading the next few commands makes it easier to understand, for some people.
Make sure /mnt/home does not exist.
# mkdir /mnt/home
# mount /dev/sda1 /mnt/home2
# cp -a /home /mnt
# umount /mnt/home
# mount --move /mnt/home /home
# rmdir /mnt/home
# sed "s|/dev/VolGroup00/LogVol00|/dev/sda1|" /etc/fstab >/etc/fstab- && \
# mv -f /etc/fstab- /etc/fstab
No whatever file editing is needed.
That is it
Make sure no errors produced after each command has run.
----- Original Message -----
From: Claude Jones <claude_jones at levitjames.com>
To: For users of Fedora Core releases <fedora-list at redhat.com>
Subject: Re: moving /home [Solved - Corrected HowTo]
Date: Monday 05 December 2005 19:44
>I apologize for this dual-post, but the first contained a serious error:
>On Sun December 4 2005 9:47 am, Claude Jones wrote:
>> I would like to move my home directory to a new 300GB SATA drive - I edit
>> video, so I need lots of space.
>> I've installed the hardware, and using qtparted I've formatted it as ext3
>> - in qtparted it appears as sda1
>> My current mounts:
>> /dev/mapper/VolGroup00-LogVol02 on / type ext3 (rw)
>> /dev/proc on /proc type proc (rw)
>> /dev/sys on /sys type sysfs (rw)
>> /dev/devpts on /dev/pts type devpts (rw,gid=5,mode=620)
>> /dev/hdb1 on /boot type ext3 (rw)
>> /dev/shm on /dev/shm type tmpfs (rw)
>> /dev/mapper/VolGroup00-LogVol00 on /home type ext3 (rw)
>> /dev/hda1 on /mnt/windows type ntfs (ro,umask=0222,gid=100)
>> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
>> /proc on /var/named/chroot/proc type none (rw,bind)
>> sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
>> I'm caught in a circular logic trap and I can't figure out what to do
>> next. I've read the mount and fstab man pages, and googled this issue, but
>> I'm missing something. What would be the next step?
>The long thread that followed this original query for help was the result of
>my having to overcome many years of experience administering Windows based
>file systems. I won't attempt to write a dissertation on the differences
>between Linux and Windows file systems and media organization, but, in the
>hope that it may be of use, here are the steps that worked.
>1) Install new drive:
>After physical installation and a reboot, I opened qtparted (Linux
>partitioning/formatting tool) - qtparted recognized the drive immediately as
>sda. I created a single partition on my new drive and formatted it as ext3.
>2) Create a temporary mount point:
>I created a new directory in /mnt calling it "mynewhome"
>3) Boot into runlevel 1:
>Restart the computer and at the first Fedora splash screen press the letter
>'a' on keyboard. This halts the boot process and brings up the kernel line.
>At the end of that line type '1' (the number one without quotes), and press
>the enter key - this boots the machine into runlevel 1 or single user mode.
>4) Mount drive to new directory:
>When the prompt comes up, mount the new drive to the directory previously
>created in /mnt (step 2 above)
>'mount /dev/sda1 /mnt/mynewhome'
>(the '1' is added to 'sda' to indicate the first partition on drive sda -
> even though there is only one partition on the drive, this is the syntax
> that must be used, else the command will fail)
>5) Copy the contents of current home folder to the new drive:
>'cp -a/home/* /mnt/mynewhome'
>(this step is important to get right - it takes all the contents of the
>current /home and copies them to the root of the new drive, sda1, now
> mounted as /mnt/mynewhome - you want everything BELOW /home to be
> transferred to this new location - also, when copying the contents of /home
> to the new location, you want all the attributes of the files preserved
> which is what the '-a' option to the 'cp' command does - read the 'man cp'
> pages for details of this command)
>6) Edit the fstab file:
>This file is read at boot time by your system, and mounts your drives to the
>correct locations in your directory structure.
>There are a limited number of text editors available at the command line. I
>This opens the file in text editing mode. Find the line that contains the
>mount for the current /home - on my system it looked like this:
>/dev/VolGroup00/LogVol00 /home ext3 defaults 1 2
>Comment this line by adding a '#' to front of it.
>Now, add the line that will mount your new home - mine looked liked this:
>/dev/sda1 /home ext3 defaults 1 2
>If you use the 'joe' editor to to do this, then 'ctl-k' followed by 's' will
>ask you if you want to save the file; pressing 'enter' will save. 'ctl-k'
>followed by 'q' will exit joe.
>7) Reboot - if you got it all right, your machine should boot normally, but
>using the new /home. If you made a mistake, you haven't altered anything
>irreparably. You can revert the edited 'fstab' file to its prior state
>easily, and be back where you started. All your old /home files will still
> be there...
>After this has all run in a stable fashion for a few days, I will then
> tackle how to eliminate the logical volume group 00, and take that space
> and add it my logical volume group 01, which is where my '/' (the rest of
> the file system) is mounted.
>Hope this of future help to someone, and thanks to all who helped me to
> figure this out.
>Bluemont, VA, USA
More information about the fedora-list