Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

Moving old gentoo install to new hard drive [solved]

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
31 posts
  • 1
  • 2
  • Next
Author
Message
elensia
n00b
n00b
Posts: 11
Joined: Mon Mar 01, 2010 7:16 pm

Moving old gentoo install to new hard drive [solved]

  • Quote

Post by elensia » Sun Mar 28, 2010 3:28 pm

Hello.

I am new here and with gentoo and this will be my first post.
I had some help installing gentoo on my system and everything was ok except a minor detail.

It was installed in my first physical IDE hard drive on the second partition while windows is on the first partition.

Code: Select all

# fdisk  -l

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2ad92ad8

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1       10199    81920000    7  HPFS/NTFS
/dev/hda2           10200       18867    69625710   83  Linux
/dev/hda3           18868       19457     4739175   82  Linux swap / Solaris
What i need now is to move the whole gentoo install to my second physical hard drive:

Code: Select all

# fdisk  -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xd982d982

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       29903   240195816   83  Linux
/dev/sda2           29904       30401     4000185   82  Linux swap / Solaris
This is a sata hard drive but i have made the partitions with the same filesystem type, (reiserfs).

If i am not mistaken i have to use dd to copy the install over the new hard drive but i have never done this.

What steps do i need to take to copy it properly and have it working flawlessly?
Last edited by elensia on Wed Apr 21, 2010 9:27 pm, edited 1 time in total.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sun Mar 28, 2010 3:46 pm

elensia,

Welcome to Gentoo.

You can indeed use dd to copy things but there are a number of problems with dd.
dd does a low level disk block by disk block copy, taking no account of the content. This means it copies your entire filesystem as is, including the empty space and the structure of the filesystem. As first sight - this appears to be exactly what you need.

However to copy is an *identical* copy of the input - that means that if your new partition is bigger than your old one, the spare space will vanish in the copy.
Its physically still there but you can't use it, so I suggest you don't use dd.

If you attempt to copy a live system, you will have problems copying /dev /sys and /proc, which are not real filesystems at all.
Boot with a liveCD mount your Gentoo install, then use the cp -a command.
Read

Code: Select all

man cp
This will copy the files on your install to their new home, preserving their permissions and ownership. It will also safely copy your /dev /sys and /proc, which will be almost empty as your install is not running.

You will need to finish off the copy by adjusting /etc/fstab to point to Gentoos new home and you will need to install grub to the MBR if you want to be able to boot from the SATA drive. This is because the bootloader is installed outside of any filesystem, so cannot be copied using the cp command.
dd can copy it but you don't want an exact copy.

Other readers will suggest rsync or even tar. They all work
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
Raistlin Majere
n00b
n00b
User avatar
Posts: 61
Joined: Thu Feb 04, 2010 9:51 pm

  • Quote

Post by Raistlin Majere » Sun Mar 28, 2010 4:30 pm

i would recommend rsync ( or something like it) over using cp -a because if it gets interrupted , you would have to start all over with cp ( i could be wrong) where as something like rsync won't make you recopy the same files if something interrupts it and rsync will cleanup anything it doesn't finish copying if it's interrupted
I recommend using SystemRescueCD ( it comes with rsync) to do this.

Of course check the rsync man page but you want something like

Code: Select all

rsync -av /mnt/point/of/src/ /mnt/point/of dest/
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Mon Mar 29, 2010 12:49 am

... and use the --exclude option something like this:

Code: Select all

rsync -av --exclude /proc --exclude /tmp --exclude /sys / <target>
and re-create those excluded directories on the target before booting:

Code: Select all

mkdir <target>/tmp <target>/sys <target>/proc
chmod 1777 <target>/tmp
Last edited by Mike Hunt on Mon Mar 29, 2010 3:30 am, edited 3 times in total.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Mar 29, 2010 12:52 am

You can even use SystemrescueCD and use the Stage 5 backup method.
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Mon Mar 29, 2010 12:55 am

:arrow: Stage 5

Fixed that for you. :)
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Mar 29, 2010 12:58 am

Stage 5 using SystemRescueCD : http://www.gentoo-quebec.org/wiki/index ... emRescueCD
Top
cach0rr0
Bodhisattva
Bodhisattva
User avatar
Posts: 4123
Joined: Thu Nov 13, 2008 11:14 pm
Location: Houston, Republic of Texas

  • Quote

Post by cach0rr0 » Mon Mar 29, 2010 2:48 am

NeddySeagoon wrote:
However to copy is an *identical* copy of the input - that means that if your new partition is bigger than your old one, the spare space will vanish in the copy.
Its physically still there but you can't use it, so I suggest you don't use dd.
Could you not just do an fdisk+edit+write, then grow the file system(s) as needed?

I will concede this isn't the swiftest process in the world, but I've used this to clone machines in the past.
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Mar 29, 2010 3:11 am

Indeed, DD copy the exact size of the partition, so that's why it's better to use tar when you want to put your Gentoo box inside a new HDD or a new computer :P
Top
cach0rr0
Bodhisattva
Bodhisattva
User avatar
Posts: 4123
Joined: Thu Nov 13, 2008 11:14 pm
Location: Houston, Republic of Texas

  • Quote

Post by cach0rr0 » Mon Mar 29, 2010 3:45 am

d2_racing wrote:Indeed, DD copy the exact size of the partition, so that's why it's better to use tar when you want to put your Gentoo box inside a new HDD or a new computer :P
I guess the main reason I opted for dd, is that I was doing all of this over the network, using dd piped to netcat.

Basically, had netcat listening on destination host with of=/dev/sda, and on the source host if=/dev/sda piped to nc x.x.x.x:zz (where x.x.x.x:zz is remote host IP and port)

Took ~3 hours to clone a 320GB drive, and all I had to do when I was done was change the IP and hostname.
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Mon Mar 29, 2010 6:32 pm

cach0rr0,

Once upon a time, growing a filesystem was not supported, but yes, you could partition the new drive, dd the partition and providing you are using a filesystem that supports growing, grow the filesystem to fill the partition.

cp, rsync, tar are all faster, as you don't copy empty space and the copy gets rid of any file fragmentation you might have too. dd carefully preserves this.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Tue Mar 30, 2010 1:19 am

Indeed, that's why I like tar .
Top
richard.scott
Veteran
Veteran
Posts: 1497
Joined: Mon May 19, 2003 5:19 pm
Location: Oxfordshire, UK
Contact:
Contact richard.scott
Website

  • Quote

Post by richard.scott » Tue Mar 30, 2010 8:06 am

What about using a clonezilla cd to do the copy?
Top
cwr
Veteran
Veteran
Posts: 1969
Joined: Sat Dec 17, 2005 11:17 am

  • Quote

Post by cwr » Tue Mar 30, 2010 10:34 am

I _think_ Clonezilla is basically a front end to dd; I haven't looked at it in
a while, but when I did it was pretty rough. On the whole, tar seems
simpler and more effective.

Will
Top
richard.scott
Veteran
Veteran
Posts: 1497
Joined: Mon May 19, 2003 5:19 pm
Location: Oxfordshire, UK
Contact:
Contact richard.scott
Website

  • Quote

Post by richard.scott » Tue Mar 30, 2010 11:25 am

Clonezilla only uses dd when the other tools it has don't work.
IMHO its a hassle free way to move from one drive to another.

You don't need any experience at moving data, you just need to select the correct drives as source and target and then come back in an hour or two.

Rich
Top
Old_dude
n00b
n00b
Posts: 6
Joined: Sat May 28, 2005 6:17 am

  • Quote

Post by Old_dude » Sun Apr 04, 2010 2:47 am

Why not just use the stage4 script to build archive the system, extract it to the new location? It is easy, I just did so when upgrading my server to a new hard drive. HTH
Gentoo noob since ALWAYS
Top
keenblade
Veteran
Veteran
User avatar
Posts: 1087
Joined: Sun Oct 03, 2004 6:19 pm
Contact:
Contact keenblade
Website

  • Quote

Post by keenblade » Sun Apr 04, 2010 8:51 am

richard.scott wrote:Clonezilla only uses dd when the other tools it has don't work.
IMHO its a hassle free way to move from one drive to another.

You don't need any experience at moving data, you just need to select the correct drives as source and target and then come back in an hour or two.

Rich
I agree. And clonezilla is incredibly fast, easy and one of the best. Or use stage5 which is also very nice.
Anyway it's all the same at the end...
Need help to get it working: "x-fi surround 5.1"
Top
wjb
l33t
l33t
User avatar
Posts: 681
Joined: Sun Jul 10, 2005 9:40 am
Location: Fife, Scotland

  • Quote

Post by wjb » Sun Apr 04, 2010 12:30 pm

I'll say Clonezilla too.

I recently moved gentoo from dying 200Gb to a new 500Gb disk. The step by step guides made it pretty painless.
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Sun Apr 04, 2010 2:08 pm

cwr wrote:I _think_ Clonezilla is basically a front end to dd; Will
I would like to know that too, because if it's really a DD front end, then sometimes I don't want to use the DD method if for example, I change my HDD and I double my partition size.
Top
keenblade
Veteran
Veteran
User avatar
Posts: 1087
Joined: Sun Oct 03, 2004 6:19 pm
Contact:
Contact keenblade
Website

  • Quote

Post by keenblade » Sun Apr 04, 2010 3:26 pm

d2_racing wrote:
cwr wrote:I _think_ Clonezilla is basically a front end to dd; Will
I would like to know that too, because if it's really a DD front end, then sometimes I don't want to use the DD method if for example, I change my HDD and I double my partition size.
No it is not a front end to dd. Only for unsupported file system, sector-to-sector copy is done by dd. It is a live cd that can use partclone, partimage, ntfsclone, and dd to clone partition. It supports both grub1 and 2. It is very advanced, lots of possibility. It can massively clone. It can be booted from cd/dvd or usb.
Anyway it's all the same at the end...
Need help to get it working: "x-fi surround 5.1"
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Apr 05, 2010 2:29 am

I gonna try this one next week for sure :P
Top
Element Dave
Tux's lil' helper
Tux's lil' helper
Posts: 82
Joined: Fri Nov 10, 2006 5:54 pm

  • Quote

Post by Element Dave » Mon Apr 05, 2010 4:10 pm

keenblade wrote:
d2_racing wrote: I would like to know that too, because if it's really a DD front end, then sometimes I don't want to use the DD method if for example, I change my HDD and I double my partition size.
No it is not a front end to dd. Only for unsupported file system, sector-to-sector copy is done by dd. It is a live cd that can use partclone, partimage, ntfsclone, and dd to clone partition. It supports both grub1 and 2. It is very advanced, lots of possibility. It can massively clone. It can be booted from cd/dvd or usb.
I've used ntfsclone many times over the past couple of years and it works very well. The images are saved fast and efficiently (i.e., it doesn't store unused clusters), and more important, the restore process has never failed. I've used it to move partitions as well as restore them to the original location. In my experience, it works better than the commercial tools I've used, probably because of the environment from which it's run. The version of NTFS that was imaged was that which is used by XP (3.1? -- offhand guess).

For backup of Gentoo/Linux, I just use a custom Perl script that is nothing more than a front-end to tar to maintain multiple sets of incremental backups.

One "trick" for using tar to backup a complete live system: *bind* your root filesystem to a temporary mount point and back _that_ up. E.g.,

Code: Select all

mkdir /mnt/dump
mount --bind / /mnt/dump
tar -c[options] -C /mnt/dump ./
umount /mnt/dump
rmdir /mnt/dump
That will back up everything under / including static files under e.g., /dev, without descending into submounts. I.e., /mnt/dump (in the example above) represents your "real" root filesystem without any other filesystems mounted on it.
Top
gerard27
Advocate
Advocate
Posts: 2377
Joined: Sun Jan 04, 2004 3:30 pm
Location: Netherlands

  • Quote

Post by gerard27 » Mon Apr 05, 2010 5:46 pm

I have moved my Gentoo partitions several times.
I always use rescuecd.
I simply use

Code: Select all

mount /dev/<original> /mnt/gentoo
mount /dev/<new-partion> /mnt/backup
cp -a /mnt/gentoo/* /mnt/backup
I use it also to make back-ups.
Never any problems.
It's probably not the most sophisticated way,but it works and is simple.
Gerard.
To install Gentoo I use sysrescuecd.Based on Gentoo,has firefox to browse Gentoo docs and mc to browse (and edit) files.
The same disk can be used for 32 and 64 bit installs.
You can follow the Handbook verbatim.
http://www.sysresccd.org/Download
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Mon Apr 05, 2010 8:14 pm

As anyone knows, I use a tarball backup, because I use it to backup my box or migrate to a newer one :P
Top
Yamakuzure
Advocate
Advocate
User avatar
Posts: 2323
Joined: Wed Jun 21, 2006 11:06 am
Location: Adendorf, Germany
Contact:
Contact Yamakuzure
Website

  • Quote

Post by Yamakuzure » Wed Apr 07, 2010 8:27 am

Please take a look at "rdup" in the sunrise overlay. It allows to do everything with a single command. Incrementally. With and without tar. With and without encryption.


@gerard82: What about the nodes in dev? sys? proc? Do you get errors from cp? (I ask, because I had alot of problems with that exact method when copying the root partition, and that was the reason why I ended with "rdup")

Almost forgot: rdup project page
Edited 220,176 times by Yamakuzure
Top
Post Reply

31 posts
  • 1
  • 2
  • Next

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic