FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 03-25-2012, 05:46 AM
Marc Shapiro
 
Default Best way to migrate disks

I have an old 40GB disk and a recently purchased 1TB disk. The new disk
has been partitioned into a 2GB swap partition, two 500MB partitions
that are currently empty and the remainder is an LVM2 PV which I have
added to my VG, so I now have plenty of space. So far, so good.


My problem is that I am still booting off of the 40GB disk and my /
partition has pretty much run out of space (it is about 280MB). I want
to migrate everything from there into one of the 500MB partitions on the
new drive and boot from there. What is the best way to do this? Any
suggestions?


Marc


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

Archive: 4F6EB12D.1080602@gmail.com">http://lists.debian.org/4F6EB12D.1080602@gmail.com
 
Old 03-25-2012, 06:25 AM
Olaf Reitmaier Veracierta
 
Default Best way to migrate disks

On 03/25/2012 01:16 AM, Marc Shapiro wrote:
I have an old 40GB disk and a recently purchased 1TB disk. The new
disk has been partitioned into a 2GB swap partition, two 500MB
partitions that are currently empty and the remainder is an LVM2 PV
which I have added to my VG, so I now have plenty of space. So far,
so good.


My problem is that I am still booting off of the 40GB disk and my /
partition has pretty much run out of space (it is about 280MB). I
want to migrate everything from there into one of the 500MB partitions
on the new drive and boot from there. What is the best way to do
this? Any suggestions?


Marc




First, make a backup. Don't modify anything on the old disk, just in the
new one!!!


What are the 500 MB partitions for? Well It does not matters, but I will
use them in this example. I always do this on my laptops.


Make identical (size) volumes on LVM in the new disk as many partitions
you have on the old disk.


Now reboot with debian live cd or usb stick and bring up LVM or... do
all of this without reboot directly from your current system running but
stop as many services as you can.


Then supossing your old disk is:

old disk: sda1=/boot (1GB), sda2=swap (9GB), sda3=/ (30GB)

You must configure your new disk similar to this:

new disk: sdb1=/boot (500M), sdb2=none (500M), sdb3=lvm=>rest(999GB). In
lvm at vg00 you must create: lvswap (9GB), lvroot (30GB).


Then use the command "dd" to copy each partition... one by one... byte
by byte:


dd if=/dev/sda3 of=/dev/vg00/lvroot

The same with /dev/sda1 and all the none swap partions of your old disk.

Later copy the boot sector with GRUB: dd if=/dev/sda of=/dev/sdb bs=512
count=1


You must mount and edit the /boot/grub/menu.lst and
/boot/grub/device.maps in the NEW DISK to fit the new hardware names...
adjust "sda" to "sdb".


Disconnect the old disk and boot from new one installed as master on
your mother board.


Done!

If anything fails you always can start all over again your old disk is save.

--
---------------------------------------------------------------------
"You don't know where your shadow will fall",
Somebody.-
---------------------------------------------------------------------
Ing. Olaf Reitmaier Veracierta<olafrv@gmail.com>
---------------------------------------------------------------------
Personal Web Page -- http://olafrv.com -- info@olafrv.com
---------------------------------------------------------------------


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

Archive: 4F6EBA41.4080101@gmail.com">http://lists.debian.org/4F6EBA41.4080101@gmail.com
 
Old 03-25-2012, 06:58 AM
Stan Hoeppner
 
Default Best way to migrate disks

On 3/25/2012 12:46 AM, Marc Shapiro wrote:
> I have an old 40GB disk and a recently purchased 1TB disk. The new disk
> has been partitioned into a 2GB swap partition, two 500MB partitions
> that are currently empty and the remainder is an LVM2 PV which I have
> added to my VG, so I now have plenty of space. So far, so good.
>
> My problem is that I am still booting off of the 40GB disk and my /
> partition has pretty much run out of space (it is about 280MB). I want
> to migrate everything from there into one of the 500MB partitions on the
> new drive and boot from there. What is the best way to do this? Any
> suggestions?

Need more details. Output of fdisk -l for both drives, lilo/grub conf
files, and /etc/fstab would be helpful, as well as the LVM config.

--
Stan


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4F6EC21F.8000400@hardwarefreak.com">http://lists.debian.org/4F6EC21F.8000400@hardwarefreak.com
 
Old 03-25-2012, 11:12 AM
Camaleón
 
Default Best way to migrate disks

On Sat, 24 Mar 2012 22:46:21 -0700, Marc Shapiro wrote:

> I have an old 40GB disk and a recently purchased 1TB disk. The new disk
> has been partitioned into a 2GB swap partition, two 500MB partitions
> that are currently empty and the remainder is an LVM2 PV which I have
> added to my VG, so I now have plenty of space. So far, so good.
>
> My problem is that I am still booting off of the 40GB disk and my /
> partition has pretty much run out of space (it is about 280MB). I want
> to migrate everything from there into one of the 500MB partitions on the
> new drive and boot from there. What is the best way to do this? Any
> suggestions?

I would try with Clonezilla run from a LiveCD.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jkmuie$q88$10@dough.gmane.org">http://lists.debian.org/jkmuie$q88$10@dough.gmane.org
 
Old 03-25-2012, 05:14 PM
Marc Shapiro
 
Default Best way to migrate disks

On 03/24/12 23:58, Stan Hoeppner wrote:

On 3/25/2012 12:46 AM, Marc Shapiro wrote:

I have an old 40GB disk and a recently purchased 1TB disk. The new disk
has been partitioned into a 2GB swap partition, two 500MB partitions
that are currently empty and the remainder is an LVM2 PV which I have
added to my VG, so I now have plenty of space. So far, so good.

My problem is that I am still booting off of the 40GB disk and my /
partition has pretty much run out of space (it is about 280MB). I want
to migrate everything from there into one of the 500MB partitions on the
new drive and boot from there. What is the best way to do this? Any
suggestions?


Need more details. Output of fdisk -l for both drives, lilo/grub conf
files, and /etc/fstab would be helpful, as well as the LVM config.

Sorry, I just realized this morning that I had not mentioned that I am
using lilo, not GRUB. (NOTE: All three lvm partitions are in a single
volume group, so that is all taken care of. All that I need to migrate
is the / partition so that I can get some extra space for it. I may
move the swap on the new drive into the lvm. No reason not to really,
is there? If I do that, however, it can wait until after I am able to
boot from the new disk.


/boot/lilo.conf:

boot=/dev/disk/by-id/ata-WDC_WD400EB-00CPF0_WD-WCAAT1261081
large-memory
compact
lba32
vga=normal
prompt
timeout=100
default=Linux

image=/vmlinuz
root="UUID=5e0d4da4-aba3-4965-8fb4-788501b0fe69"
initrd=/initrd.img
label=Linux
read-only

image=/vmlinuz.old
root="UUID=5e0d4da4-aba3-4965-8fb4-788501b0fe69"
initrd=/initrd.img.old
label="Linux_Old"
read-only

image=/boot/memtest86+.bin
label = memtest86+

#other=/dev/hdc1
# label=Win98SE
# map-drive=0x80
# to=0x81
# map-drive=0x81
# to=0x80



As for the rest:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump>
<pass>


UUID=5e0d4da4-aba3-4965-8fb4-788501b0fe69 / ext3
errors=remount-ro 0 1
UUID=babd50db-38b8-4b64-940a-6832af5bd0a9 none swap
sw 00
proc /proc proc defaults
0 0
none /proc/bus/usb usbfs defaults
0 0
/dev/mapper/vg1-tmp /tmp ext3 defaults
0 2
/dev/mapper/vg1-var2 /var ext3 defaults
0 2
/dev/mapper/vg1-usr /usr ext3 defaults
0 2
/dev/mapper/vg1-photos /usr/local/photos ext3 defaults
0 2
/dev/mapper/vg1-home /home ext3 defaults
0 2
/dev/mapper/vg1-vDisks /home/testuser/VirtualBoxDisks ext3
defaults0 2


#
# Removeable Media
#

#/dev/lasonic /media/mp3r vfat defaults,user,noauto
0 0
/dev/fd0 /media/floppy auto user,noauto
0 0
/dev/cdrom5 /media/cdrom iso9660 ro,user,noauto
0 0
#/dev/sdb1 /media/pen vfat user,umask=0000,noauto
0 0
#/dev/sdb1 /media/camera vfat user,umask=0000,noauto
0 0
UUID=A8B0-984A /media/mp3a vfat defaults,user,noauto
0 0
LABEL=PHILIPS /media/mp3r vfat defaults,user,noauto
0 0
UUID=DA74-E37F /media/sandisk vfat defaults,user,noauto
0 0
UUID=A8B0-984A /media/eclipse vfat defaults,user,noauto
0 0
UUID=261A-40DE /media/kingston vfat defaults,user,noauto
0 0
UUID=0C50-B006 /media/mp3r2 vfat defaults,user,noauto
0 0
UUID=6A3D-C6A2 /media/pen/anna vfat defaults,user,noauto
0 0
obexfs#-b74:A7:22:01:5D:ED /media/phone fuse defaults,user,noauto
0 0



Old drive:

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa51aa51a

Device Boot Start End Blocks Id System
/dev/sda1 * 1 36 289138+ 83 Linux
/dev/sda2 37 72 289170 83 Linux
/dev/sda3 73 2323 18081157+ 8e Linux LVM
/dev/sda4 2324 4865 20418615 8e Linux LVM


New Drive:

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
222 heads, 30 sectors/track, 293322 cylinders
Units = cylinders of 6660 * 512 = 3409920 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20677b30

Device Boot Start End Blocks Id System
/dev/sdc1 1 631 2101215 82 Linux swap / Solaris
/dev/sdc2 632 781 499500 83 Linux
/dev/sdc3 782 931 499500 83 Linux
/dev/sdc4 932 293322 973662030 8e Linux LVM



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

Archive: 4F6F525E.7090603@gmail.com">http://lists.debian.org/4F6F525E.7090603@gmail.com
 
Old 03-25-2012, 07:32 PM
Olaf Reitmaier Veracierta
 
Default Best way to migrate disks

On 03/25/2012 12:44 PM, Marc Shapiro wrote:
Sorry, I just realized this morning that I had not mentioned that I am
using lilo, not GRUB.
Well, with dd is almost the same, just copy the first sector as I've
shown it to you:


dd if=/dev/sda of=/dev/sdb bs=512 count=1

More info:
<http://members.storm.ca/%7Eyan/Hard-Disk-Upgrade.html>
http://lilo.alioth.debian.org/olddoc/html/user_21-5.html

(NOTE: All three lvm partitions are in a single volume group, so that
is all taken care of).

You still can use dd to copy partitions between disks.

If the old partition you want to copy is on LVM you don't need to stop
all services just make a snapshot volume then use dd.


I may move the swap on the new drive into the lvm. No reason not to
really, is there?
The only valid reason is an affirmative answer to: Are you going to
resize your swap space in the future?


If I do that, however, it can wait until after I am able to boot from
the new disk.

Yes, it can wait and you can be disable it if you want.

--
---------------------------------------------------------------------
"You don't know where your shadow will fall",
Somebody.-
---------------------------------------------------------------------
Ing. Olaf Reitmaier Veracierta<olafrv@gmail.com>
---------------------------------------------------------------------
Personal Web Page -- http://olafrv.com -- info@olafrv.com
---------------------------------------------------------------------


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

Archive: 4F6F72B7.8050905@gmail.com">http://lists.debian.org/4F6F72B7.8050905@gmail.com
 
Old 03-25-2012, 07:48 PM
Marc Auslander
 
Default Best way to migrate disks

You are probably asking a more subtle question that I'm going to
answer but ...

As far as the root partition itself, just make a new file system in
the partition you want to be the new boot and use tar to copy the old
root over. Make sure you don't copy anything mounted on root - just
root itself.

Then edit fstab in the obvious way to account for the new UUID of the
new root.

Assumine LILO can boot from the partition on the larger disk, fix
lilo.conf in the obvious way, run lilo, and remember to make the new
root partion bootable.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87limowjfm.fsf@aptiva.optonline.net">http://lists.debian.org/87limowjfm.fsf@aptiva.optonline.net
 
Old 03-26-2012, 02:47 PM
Stan Hoeppner
 
Default Best way to migrate disks

On 3/25/2012 2:48 PM, Marc Auslander wrote:

> As far as the root partition itself, just make a new file system in
> the partition you want to be the new boot and use tar to copy the old
> root over. Make sure you don't copy anything mounted on root - just
> root itself.

'cp -a' worked fine for me the last time I did such a boot/root
filesystem migration to a new disk. What advantage does tar have here?

--
Stan


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4F70816A.9000807@hardwarefreak.com">http://lists.debian.org/4F70816A.9000807@hardwarefreak.com
 
Old 03-26-2012, 04:50 PM
Andrei POPESCU
 
Default Best way to migrate disks

On Lu, 26 mar 12, 09:47:06, Stan Hoeppner wrote:
> On 3/25/2012 2:48 PM, Marc Auslander wrote:
>
> > As far as the root partition itself, just make a new file system in
> > the partition you want to be the new boot and use tar to copy the old
> > root over. Make sure you don't copy anything mounted on root - just
> > root itself.
>
> 'cp -a' worked fine for me the last time I did such a boot/root
> filesystem migration to a new disk. What advantage does tar have here?

I'll add 'rsync -ax' in the mix. 'x' will take care of ignoring other
filesystems (like /dev /sys or whatever).

Kind regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
 
Old 03-26-2012, 04:58 PM
Marc Auslander
 
Default Best way to migrate disks

Stan Hoeppner <stan@hardwarefreak.com> writes:

> On 3/25/2012 2:48 PM, Marc Auslander wrote:
>
>> As far as the root partition itself, just make a new file system in
>> the partition you want to be the new boot and use tar to copy the old
>> root over. Make sure you don't copy anything mounted on root - just
>> root itself.
>
> 'cp -a' worked fine for me the last time I did such a boot/root
> filesystem migration to a new disk. What advantage does tar have here?
>
> --
> Stan
>
Sorry to cause confusion. I've always used tar for this purpose and
so my fingers "know what to do". cpio was always an alternative.

In newer versions of Unix, cp also has been extended to be useable for
this purpose.

Probably I should of just said "copy the file system contents".


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87zkb3ti32.fsf@aptiva.optonline.net">http://lists.debian.org/87zkb3ti32.fsf@aptiva.optonline.net
 

Thread Tools




All times are GMT. The time now is 02:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org