Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Cloning hda to new internal disk (was How to copy a laptop HD?) (http://www.linux-archive.org/debian-user/92278-cloning-hda-new-internal-disk-how-copy-laptop-hd.html)

Ron Johnson 05-21-2008 02:20 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/20/08 15:55, Lee Glidewell wrote:
> Have a look at partimage. Specifically you might be interested in the
> CloneZilla live distro. It's built specifically for the purpose of porting
> installations between hard disks.

In a similar vein to OP's question, I am going to buy a new boot
disk, because my hda is old enough -- and drives are cheap enough --
that I'd rather replace it before it fails.

So I checked out CloneZilla, but it seems to be aimed at
institutional use. Even partimage seems to need an intermediary step.

Is there any way to directly clone /dev/hda to /dev/sdX, so that I
can then boot off of /dev/sdX?

- --
Ron Johnson, Jr.
Jefferson LA USA

ESPN makes baseball players better.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIM4bhS9HxQb37XmcRAnEgAJ9Q0InLDNLoQ3itUUnosl 7Xf9V3wQCeJ2d1
pmVBe2+JzN+XwwM+UyZYPXY=
=9QD/
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Raj Kiran Grandhi 05-21-2008 02:50 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
Ron Johnson wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/20/08 15:55, Lee Glidewell wrote:
Have a look at partimage. Specifically you might be interested in the
CloneZilla live distro. It's built specifically for the purpose of porting
installations between hard disks.


In a similar vein to OP's question, I am going to buy a new boot
disk, because my hda is old enough -- and drives are cheap enough --
that I'd rather replace it before it fails.

So I checked out CloneZilla, but it seems to be aimed at
institutional use. Even partimage seems to need an intermediary step.

Is there any way to directly clone /dev/hda to /dev/sdX, so that I
can then boot off of /dev/sdX?


If you can boot some live system, you can just partition your new disk,
mount them all, copy all your files over, fix /etc/fstab and
/boot/grub/menu.lst, mount the new boot partition at /boot and run
grub-install /dev/sda. With this approach, you are free to change your
partitioning scheme.


Alternatively, if your new partitions have the same layout but larger,
then you can use dd to clone each partition individualy, do a resize2fs
on each of them, then fix fstab and menu.lst before running a grub-install.






- --
Ron Johnson, Jr.
Jefferson LA USA

ESPN makes baseball players better.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIM4bhS9HxQb37XmcRAnEgAJ9Q0InLDNLoQ3itUUnosl 7Xf9V3wQCeJ2d1
pmVBe2+JzN+XwwM+UyZYPXY=
=9QD/
-----END PGP SIGNATURE-----





--

If you can't explain it simply, you don't understand it well enough.
-- Albert Einstein


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Ron Johnson 05-21-2008 03:04 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Gmail *sucks*, because it screws up reply nesting. I have to
manually fix it so that people (including me) how use sane MUAs can
read it properly.

On 05/20/08 21:50, Raj Kiran Grandhi wrote:
> Ron Johnson wrote:
>> On 05/20/08 15:55, Lee Glidewell wrote:
>>> Have a look at partimage. Specifically you might be interested in the
>>> CloneZilla live distro. It's built specifically for the purpose of
>>> porting installations between hard disks.
>
>> In a similar vein to OP's question, I am going to buy a new boot
>> disk, because my hda is old enough -- and drives are cheap enough --
>> that I'd rather replace it before it fails.
>>
>> So I checked out CloneZilla, but it seems to be aimed at
>> institutional use. Even partimage seems to need an intermediary step.
>
>> Is there any way to directly clone /dev/hda to /dev/sdX, so that I
>> can then boot off of /dev/sdX?
>
> If you can boot some live system, you can just partition your new disk,
> mount them all, copy all your files over, fix /etc/fstab and

I've tried doing what you suggest, but cp leaves absolute symlinks
still pointing to the original files on the source device.

> /boot/grub/menu.lst, mount the new boot partition at /boot and run
> grub-install /dev/sda. With this approach, you are free to change your
> partitioning scheme.
>
> Alternatively, if your new partitions have the same layout but larger,
> then you can use dd to clone each partition individualy, do a resize2fs
> on each of them, then fix fstab and menu.lst before running a grub-install.

- --
Ron Johnson, Jr.
Jefferson LA USA

ESPN makes baseball players better.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIM5EqS9HxQb37XmcRAvuDAJ0cwbC1DabJTelsE0UgSj Ecv0h7HQCeODQR
yHOHkFXz2qqluAum/wgCiL4=
=9Jqp
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Lee Glidewell 05-21-2008 03:06 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
On Tuesday 20 May 2008 07:20:17 pm Ron Johnson wrote:
> In a similar vein to OP's question, I am going to buy a new boot
> disk, because my hda is old enough -- and drives are cheap enough --
> that I'd rather replace it before it fails.
>
> So I checked out CloneZilla, but it seems to be aimed at
> institutional use. Even partimage seems to need an intermediary step.
>
> Is there any way to directly clone /dev/hda to /dev/sdX, so that I
> can then boot off of /dev/sdX?
>
Yes, CloneZilla is capable of doing that. The default behavior is to create a
full disk image, including the MBR and partition table, so if you use
the "disk-to-disk" option you'll end with a ready-to-use, bootable hard disk.

By "intermediary step" I'm guessing that you meant the compressed (gzip) disk
image partimage can create -- but that's optional. There is the option to
simply clone one disk onto another.

Lee


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Ron Johnson 05-21-2008 03:39 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/20/08 22:06, Lee Glidewell wrote:
> On Tuesday 20 May 2008 07:20:17 pm Ron Johnson wrote:
>> In a similar vein to OP's question, I am going to buy a new boot
>> disk, because my hda is old enough -- and drives are cheap enough --
>> that I'd rather replace it before it fails.
>>
>> So I checked out CloneZilla, but it seems to be aimed at
>> institutional use. Even partimage seems to need an intermediary step.
>>
>> Is there any way to directly clone /dev/hda to /dev/sdX, so that I
>> can then boot off of /dev/sdX?
>>
> Yes, CloneZilla is capable of doing that. The default behavior is to create a
> full disk image, including the MBR and partition table, so if you use
> the "disk-to-disk" option you'll end with a ready-to-use, bootable hard disk.
>
> By "intermediary step" I'm guessing that you meant the compressed (gzip) disk
> image partimage can create -- but that's optional. There is the option to
> simply clone one disk onto another.

Thanks. I must have missed that...

- --
Ron Johnson, Jr.
Jefferson LA USA

ESPN makes baseball players better.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIM5llS9HxQb37XmcRAsTeAKCpJrBkAwgYYZIpm7EW8e Mm3RUYGACfXMps
Jx718AJ9rUSSnk2J3G+8MSY=
=t/vJ
-----END PGP SIGNATURE-----


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

"David Fox" 05-21-2008 04:08 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
On Tue, May 20, 2008 at 7:20 PM, Ron Johnson <ron.l.johnson@cox.net> wrote:
> Is there any way to directly clone /dev/hda to /dev/sdX, so that I
> can then boot off of /dev/sdX?

I'll probably do the mount and cp -R trick, after partitioning with a
live system, fairly soon, since I just blew some $$$ at Fry's on new
system components (ECS 6100-pn-m motherboard / 2x AMD 64 combo, 5200
mhz, plus a sata 500g drive) - to replace a now 7 year old aging
Athlon tbird setup.

Along the same tangent, I will likely be going to amd64 lenny along
with this, so I've gone and put out my dpkg selections to a file I can
read later after perhaps getting a netinstall image or some such of
debian lenny for an amd64.

I also have ubuntu HH 8.04 cd for amd64, plus I sucked down a dvd of
sabayon 3.5 for amd64 earlier this morning, so I should be set.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

"Owen Townend" 05-21-2008 04:17 AM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
On 05/20/08 21:50, Raj Kiran Grandhi wrote:
> Ron Johnson wrote:
>> Is there any way to directly clone /dev/hda to /dev/sdX, so that I
>> can then boot off of /dev/sdX?
>
> If you can boot some live system, you can just partition your new disk,
> mount them all, copy all your files over, fix /etc/fstab and
> I've tried doing what you suggest, but cp leaves absolute symlinks
> still pointing to the original files on the source device.
>
>

Hey,
You should be able to boot a livecd with both disks installed and
perform the copy. The easiest way would be to have the new disk have
the same partition layout, whether larger sizes or not doesn't matter.
Create your partitions and you should then be able to directly dd
the partitions.

e.g. Assuming the new partitions (on sdb) are >= the old ones (on sda) and
sda1=/boot sda2=/ sda3=/home, all ext3.
(need swap too, but don't need to copy it)
Then something like this _should_ work[1]:

# for i in '1 2 3';
do dd if=/dev/sda${i} of=/dev/sdb${i} bs=1M
resize2fs /dev/sdb${i}
done
# mount /dev/sda2 /mnt
# mount /dev/sda1 /mnt/boot
# mount -o bind /dev /mnt/dev
# mount -t proc none /mnt/proc
# chroot /mnt
# grub install /dev/sdb
# exit

If you're adding the new disk rather than replacing the old one then
you'll have to edit grub's menu.1st to change the devices to sdb (prob
hd1), if it's using uuid's you'll have to do so anyway.
There are plenty of grub tutorials around, easily found by searching
for 'restore grub windows' as windows is a common culprit for nuking
grub and the restore process is the same.

cheers,
Owen.

Footnotes:
--
[1] I'm not at a terminal, this is from memory, check & rtfm.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

"Javier Vasquez" 05-21-2008 01:13 PM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
On Tue, May 20, 2008 at 9:04 PM, Ron Johnson <ron.l.johnson@cox.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Gmail *sucks*, because it screws up reply nesting. I have to
> manually fix it so that people (including me) how use sane MUAs can
> read it properly.
>
> On 05/20/08 21:50, Raj Kiran Grandhi wrote:
>> Ron Johnson wrote:
>>> On 05/20/08 15:55, Lee Glidewell wrote:
>>>> Have a look at partimage. Specifically you might be interested in the
>>>> CloneZilla live distro. It's built specifically for the purpose of
>>>> porting installations between hard disks.
>>
>>> In a similar vein to OP's question, I am going to buy a new boot
>>> disk, because my hda is old enough -- and drives are cheap enough --
>>> that I'd rather replace it before it fails.
>>>
>>> So I checked out CloneZilla, but it seems to be aimed at
>>> institutional use. Even partimage seems to need an intermediary step.
>>
>>> Is there any way to directly clone /dev/hda to /dev/sdX, so that I
>>> can then boot off of /dev/sdX?
>>
>> If you can boot some live system, you can just partition your new disk,
>> mount them all, copy all your files over, fix /etc/fstab and
>
> I've tried doing what you suggest, but cp leaves absolute symlinks
> still pointing to the original files on the source device.

If you use "cp -a" you overcome this problem... See:

http://tronprog.blogspot.com/2007/05/clone-partition-with-cp.html

Only problem is /proc, which can't be copied, the directory needs just
to be created and left alone... My only problem with this approach is
that I couldn't make grub to boot. I tried both grub-install
approaches, 1st using /dev/sda as the device) and
--root-directory=/mnt/sda6, and then using the chroot after doing all
necessary bindings... None of them worked for me... There's one left
which is unmounting hda6 (my old HD boot partition) from /boot and
mounting sda6 (my new HD boot partition) on it, using still /dev/sda,
to see if that works, this is the only one thing I haven't tried with
the "cp -a" approach...

>> /boot/grub/menu.lst, mount the new boot partition at /boot and run
>> grub-install /dev/sda. With this approach, you are free to change your
>> partitioning scheme.
>>
>> Alternatively, if your new partitions have the same layout but larger,
>> then you can use dd to clone each partition individualy, do a resize2fs
>> on each of them, then fix fstab and menu.lst before running a grub-install.
>
> - --
> Ron Johnson, Jr.
> Jefferson LA USA

--
Javier


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Hugo Vanwoerkom 05-21-2008 04:06 PM

Cloning hda to new internal disk (was How to copy a laptop HD?)
 
Lee Glidewell wrote:

On Tuesday 20 May 2008 07:20:17 pm Ron Johnson wrote:

In a similar vein to OP's question, I am going to buy a new boot
disk, because my hda is old enough -- and drives are cheap enough --
that I'd rather replace it before it fails.

So I checked out CloneZilla, but it seems to be aimed at
institutional use. Even partimage seems to need an intermediary step.

Is there any way to directly clone /dev/hda to /dev/sdX, so that I
can then boot off of /dev/sdX?

Yes, CloneZilla is capable of doing that. The default behavior is to create a
full disk image, including the MBR and partition table, so if you use
the "disk-to-disk" option you'll end with a ready-to-use, bootable hard disk.

By "intermediary step" I'm guessing that you meant the compressed (gzip) disk
image partimage can create -- but that's optional. There is the option to
simply clone one disk onto another.




Not having installed CloneZilla, what happens if the old disk is 80GB
and the new one 160GB?


Hugo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


All times are GMT. The time now is 07:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.