Re: Moving /home



In comp.os.linux.setup, zeno
<geoffrey.froner@xxxxxxxxx>
wrote
on Wed, 06 Jun 2007 18:46:27 -0000
<1181155587.928272.283800@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>:
Thanks for your suggestions, however, I'm not sure about the
sequences.
First off, I am NOT now an administrator nor are their other users on
my system. No need for explications.

h.googlegroups.com>:

How to move /home dir, which is now a sub-dir of root, to a separate
partition? To be able to upgrade/alter system without affecting main data.

First, do you have a partition?

I can make one.

Good.


[1] mv /home /home.old
[2] mkdir /home

[3] chmod 755 /home

From where do I issue this command? The new partition? Or from / ?

Root; at this point you've not prepped the new partition yet.



[4] edit /etc/fstab, adding a line similar to the following.

/dev/hdax /home ext3 noatime 1 1

/dev/hdax is the new partition location.
/home is the directory you wish to mount during bootup.
ext3 is the filesystem type.

It is possible /etc/fstab may not be using /dev/hdax, but
hopefully the comments are clear in that case.

I'm running Ubuntu 6.06 which seemed a good way to get the feet wet,
except Deb is different. There is an
/etc/fstab file. Okay, is this where we go after creating /dev/
hdax: ? In that case, the previous command:
$ mv /home /old.home is not done? Or is that an alternative to the
following steps?

If you want your partition mounted at bootup you generally
have to put it into /etc/fstab as described above. (There
are alternatives such as mounting it in /etc/init.d/local,
but, since editing /etc/fstab is so simple, unless one has
removable devices or other special requrements, there's
usually not much point.)



[5] mkfs.ext3 /dev/hdax

(This, BTW, is the prep part. Partitioning using fdisk simply allocates
space.)


This prepares the partition for mounting, by writing out
(erasing, if there's already stuff on it!) blocks in
special locations (one of them's called the superblock)
and generally ensuring things are emptied/readied.

[6] mount /dev/hdax /home

And here's the actual mount. During bootup /etc/fstab is read,
and this mount automatically done.

[7] At this point you have some options, depending on how much data you
have and your paranoia.

(a) mv /home.old/* /home

This is the simplest but can be problematic if there's
an error. mv is smart enough to do a copy/delete,
however, if the destination is not on the same
partition as the source -- which is the case here.

(b) cp -rp /home.old/* /home

This doesn't handle symbolic links all that well.

(c) (cd /home.old; tar cf - .) | (cd /home; tar xpf -)

This complicated-looking command is two tar commands end to end.

(d) cd /home.old; tar czf /somewhere/backup/directory/home.dir.tgz .
cd /home; tar xzf /somewhere/backup/directory/home.dir.tgz

This is (c) with compression and an explicit file as an
intermediary. The file is of course a backup of your home directory
at that point in time.


Looking forward to clarification.

Thanks,

Zeno (Geoffrey)




HTH


--
#191, ewill3@xxxxxxxxxxxxx
"Woman? What woman?"

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • IDE HDD fail?
    ... This caused after this command: ... Device contains neither a valid DOS partition table, nor Sun, SGI or OSF ... Offline data collection status: ... Self-test execution status: ...
    (Linux-Kernel)
  • Re: How to clone Windows XP back to your HD?
    ... Admittedly, I am a little "hazy" on which command does what, but having executed both and in both and reverse order, *one* or other of the commands should have: ... Re-written the Master Boot Record - the beginning sector of a hard-drive which contains the partition table and the loading code of the active O.S. ... The MBR written with the "Grub" loading-code stubbornly refuses to be repaired with the FIXMBR / FIXBOOT commands. ...
    (microsoft.public.windowsxp.newusers)
  • Re: Help with a little dd damage!
    ... Partition 3 has different physical/logical beginnings: ... Feb 28 20:20:57 morgansmachine kernel: EXT3-fs: write access will be enabled during recovery. ... So, fingers firmly crossed, have I managed to copy enough of my hard drive with the first two commands to be able to patch back the catastrophic damage I seem to have done with the last command. ... "By choosing not to ship any proprietary or binary drivers, Fedora does ...
    (Fedora)
  • Re: Trying to move /usr - Fixed
    ... After thinking about that mv command, ... Note /dev/ad8s1e is an empty partition (a new disk, ... I'll use user and usrdemo as the names of the ... the root of the file system. ...
    (freebsd-questions)
  • add disk/partition to softRaid5
    ... I am trying to add a partition to a 3 disk RAID5 device by using ... Command: Partition number: ... Old raid-disk 0 has 2132 chunks, ...
    (comp.os.linux.misc)