View previous topic :: View next topic |
Author |
Message |
Treito n00b

Joined: 27 Sep 2005 Posts: 26
|
Posted: Wed Dec 07, 2005 10:44 pm Post subject: Changing Harddisk-Drive? |
|
|
Hello,
I plan to replace my harddrive (/dev/hdb) with a bigger one. I would like to connect the new drive via USB so it should get /dev/sda.
How can I transfer all files preserving the symlinks and not destroying the partition-table on the new drive? Can I copy the mbr too? |
|
Back to top |
|
 |
RuiP l33t


Joined: 15 Jan 2005 Posts: 643
|
Posted: Wed Dec 07, 2005 10:55 pm Post subject: |
|
|
hi,
you can do
Code: | dd if=/dev/hda of=/dev/hdb |
assuming that hda is your old harddisc and hdb the new one.
That will copy everithing from old to the new one, preserving partition table. Of course, preserving partition sizes too!!
So you get the same used space on your new hd and a lot of not used or partitioned disc space...
To copy MBRs do
Code: | dd if=/dev/hda of=/dev/hdb bs=512 count=1 |
A better solution was to make the partition tables with cfdisk (or qpart or fdisk or what ever you like more) mirroring the old hd with larger sizes or add the changes you want and #cp -av partitions one by one.
Tedious but you keep full control of partition tables. |
|
Back to top |
|
 |
Treito n00b

Joined: 27 Sep 2005 Posts: 26
|
Posted: Wed Dec 07, 2005 10:58 pm Post subject: |
|
|
Thx, but my problem is that the old partition is round about 28G and the new one 118G, How can I manage this? |
|
Back to top |
|
 |
RuiP l33t


Joined: 15 Jan 2005 Posts: 643
|
Posted: Wed Dec 07, 2005 11:00 pm Post subject: |
|
|
you have only one partition on your old hd? |
|
Back to top |
|
 |
Treito n00b

Joined: 27 Sep 2005 Posts: 26
|
Posted: Wed Dec 07, 2005 11:06 pm Post subject: |
|
|
No 2 partitions, but i don't think that i have to copy the swap-partition. Why should I have an extra boot-partition or home-partition? I does not see any advantage in this case. |
|
Back to top |
|
 |
RuiP l33t


Joined: 15 Jan 2005 Posts: 643
|
Posted: Wed Dec 07, 2005 11:23 pm Post subject: |
|
|
well, there is always plenty advantages on have /home in is one partition.
You can play around with system, make it more or less unstable... borked completly...
You can format and install everytime you want.
As long you have a separe /home partition your data is safe and apart of system error or failures.
Have other partition has is advantages. /usr/portage is made of thousand of small files. /usr/portage/distfiles can be full of large size files... diferent filesystem work better or worse with wich one of these situations... is always your choice
Finally i always have one or two extra partitions on my disks where i keep copies, made with cp -av, of my system one as backup (things *can* go wrong!) and one for experimenting new stuff.
my suggestion:
just boot from a live cd (gentoo or other like ubuntu or knoppix)
do
Code: | dd if=/dev/hda of=/dev/hdd |
replace, or change, the order of your hd ides and boot.
then with cfdisk make new partitions, at your will and needs, on your new and fresh hd.
(you can keep the old partition on old hd as backup or delete them later)
btw ext3 can easily been resize with a little risk of data lost, the others file systems can't do that, i think...
good luck and keep post on your results |
|
Back to top |
|
 |
vandalman n00b

Joined: 16 Mar 2005 Posts: 52
|
Posted: Thu Dec 08, 2005 12:20 am Post subject: |
|
|
I had to do this a while back when I need to move my home directory to another hard drive and I used
It worked for me. Check the cp manual and see if archive is what you want. |
|
Back to top |
|
 |
RuiP l33t


Joined: 15 Jan 2005 Posts: 643
|
Posted: Thu Dec 08, 2005 12:26 am Post subject: |
|
|
yes, for copy partitions with system instaled -a (archive) is the solution, because it preserves permitions and links correctly.
But, you can use rsync or tar too. |
|
Back to top |
|
 |
Treito n00b

Joined: 27 Sep 2005 Posts: 26
|
Posted: Thu Dec 08, 2005 8:39 am Post subject: |
|
|
I don't want to use other partitions because it's an HDD-recorder. So the dd-command would fail for me or I have to resize the partition later. Bad Idea.
Hmm okay, I think cp could do it fine, but I have to use an external drive case because the mainboard has only one (!) connector for IDE. I hope, cp handles symlinks correctly.
I don't have any experiences with rsync and tar would be too slow, it's only a VIA C3 800 (Samuel 2).
Thanks so far. |
|
Back to top |
|
 |
|