@Ryan: "Hello all,
I've been playing Linux off and on for for several years and recently 
implemented a Gentoo system to run web server and virtual mail. This was 
all done on hardware laying around in the draw and works very well apart 
from one small problem. The hard disk I'm using is very very noisy, so 
I'm looking to replace it with a new hard disk that has the fluid 
bearings in it i.e. Maxtor DiamondMax Plus 8 for example. The drive at 
the moment is 28GB and is partitioned like this
hda1	BOOT 	(100MB)
hda2	SWAP	(512MB)
hda3	ROOT	remaining space.
The drive I'm looking at is 40GB unit so I'm looking for the best way to 
transfer the information across so I don't loose the setup and take 
advantage of the extra space provided by the drive in the root partition?
Thanks for any help
Ryan"
    @gentoo: "<quote>
Hook your new drive as a slave i.e. /dev/hdb
Simply create the partitions as you want on hdb and make sure your new boot
partition is bootable ;-)
Let's say you keep the same scheme you described
Mount hdb1 (boot) on /mnt/new e.g.
Make sure your hda1 is mounted on /boot
cp -a /boot/* /mnt/new
Then do the same for /
Mount hdb3 on /mnt/new e.g.
Copy your files from amongst others /etc /home /bin /lib /usr /var /opt
Basically everything but /dev /proc /mnt and whatever non local file systems
you have
e.g.  cp -a /etc /mnt/new
Then remove the old disk and hook the new one as master/only disk.
If you have forgotten anything, you can put your old disk as master and have
your system back as it is now. You can also keep your old disk in your pc as
slave and mount its partitions in /mnt or wherever and have access to your old
files.
Hth
xavier"
    @Ryan: "Xavier
Thanks for the information, I'll give it a go. Just one quick question 
though, will "cp -a" cope with symbolic links or are they all going to 
break?
Thanks,
Ryan"
    @Ryan: "Xavier
<quote>
Yep did that an got confused, easily done :-)
That's half what I want, I don't want it to follow the links but once 
everything is transfered and the new hard disk is running would 
/etc/apache2/logs link back to /var/log/apache2 like it does now or I'm 
I going to have to recreate every symbolic link using just -a?
When I first read the man page I though I would have to do
cp -a -d -p -r /boot/*  /mnt/newhd/boot/
cp -a -d -p -r /home/*  /mnt/newhd/home/
but if I've got it right cp -a will do the job of -d -p -r
Sorry of being picky but it took the best part of 3 weeks getting it 
right and I don't want to wreck it now!!!
Thanks for all your help so far.
Ryan."
    @gentoo: "<quote>
Your concern is fully understandable.
-a does the job of -r -d -p indeed.
It means cp will not follow the link which would copy the file itself and
leave you with no link.
-a will copy the link as it is, i.e. you'll have another link referencing the
same target.
An example:
basil tmp # ls -gGAR riri
riri:
total 4
drwxr-xr-x    2     4096 2003-08-20 14:27 1
riri/1:
total 8
lrwxrwxrwx    1       18 2003-08-20 14:27 absolute.link -> /tmp/riri/1/file.1
-rw-rr    1        6 2003-08-20 14:13 file.1
-rw-rr    1        7 2003-08-20 14:15 .hidden
lrwxrwxrwx    1        6 2003-08-20 14:26 relative.link -> file.1
basil tmp # cp -a /tmp/riri/1 /tmp/riri/2
basil tmp # ls -gGAR riri
riri:
total 8
drwxr-xr-x    2     4096 2003-08-20 14:27 1
drwxr-xr-x    2     4096 2003-08-20 14:27 2
riri/1:
total 8
lrwxrwxrwx    1       18 2003-08-20 14:27 absolute.link -> /tmp/riri/1/file.1
-rw-rr    1        6 2003-08-20 14:13 file.1
-rw-rr    1        7 2003-08-20 14:15 .hidden
lrwxrwxrwx    1        6 2003-08-20 14:26 relative.link -> file.1
riri/2:
total 8
lrwxrwxrwx    1       18 2003-08-20 14:27 absolute.link -> /tmp/riri/1/file.1
-rw-rr    1        6 2003-08-20 14:13 file.1
-rw-rr    1        7 2003-08-20 14:15 .hidden
lrwxrwxrwx    1        6 2003-08-20 14:27 relative.link -> file.1
Notice the identical absolute link in riri/2 still pointing to the original
file which in your case is exactly what should happen.
Say you have a link in home pointing to /home/user1/dir1/file1
After the cp -a, you will have a link in /mnt/newhd/home still pointing to
/home/user1/dir1/file1 which doesn't look like what you want.
But after you boot with the new config, what was /mnt/newhd/home becomes /home
and the link is OK again.
And please edit the new fstab in your /mnt/newhd... __before__ you swap HD if
you changed your partitioning scheme."
    @Ryan: "[SNIP]
Thanks for all who helped. I got it all transferred without any problems 
by taking the machine offline for an hour. Booting it up using the 
Gentoo install CD and just doing a cp -a /mnt/oldhd /mnt/newhd for each 
partition.
Thanks again.
Ryan."
{'source': 'USENET', 'other_information': '{"reply_count": 5, "forum_name": "alt.os.linux.gentoo.20140627.mbox"}', 'file': 'data/output/usenet-alt.os.parquet'}