public inbox for gentoo-amd64@lists.gentoo.org
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: gentoo-amd64@lists.gentoo.org
Subject: [gentoo-amd64]  Re: Cloning a system drive
Date: Sat, 6 Oct 2007 01:53:37 +0000 (UTC)	[thread overview]
Message-ID: <pan.2007.10.06.01.53.37@cox.net> (raw)
In-Reply-To: 5bdc1c8b0710051358g74f95702rb82a29219d890919@mail.gmail.com

"Mark Knecht" <markknecht@gmail.com> posted
5bdc1c8b0710051358g74f95702rb82a29219d890919@mail.gmail.com, excerpted
below, on  Fri, 05 Oct 2007 13:58:18 -0700:

>    My system drive is making some naughty sounding noises to I'm
> thinking I'd better do something fairly quickly. I'm wondering what the
> best solution for this problem is?
> 
>    I'm really looking for an almost 1 step fix if possible. If I could
> get a new drive, put it in the box, and then clone to that drive
> directly that would be great.
> 
>    The system has both Win XP and Gentoo AMD64. The disk layout is
> shown below. I beleive the way I shoehorned XP into this machine was to
> steal the original boot partition as a small C: drive and then the buld
> of Windows is on a larger partition at the end of the drive.

I've migrated hard drives under old-one-dieing conditions a couple times 
in the last few years.  Fortunately, the old one has always been still 
usable, but that's why I went with RAID this time.

What I do is take the opportunity to redesign my partition layouts and 
the like (altho this time I have most stuff on LVM, which should help 
next time).  The disk is always larger, and sometimes I've switched 
distributions or something, so need to optimize my layout.  Thus, the 
first step is simply deciding how I want my partitions split up and what 
size each will be, then choosing the order I want to lay them out.  (This 
time, the first with RAID and LVM, I had that to think about too, 
partitions on the physical disks for the various RAID levels I wanted to 
run, then the RAID, choosing partitioned or not as appropriate, then the 
filesystem directly on RAID for the boot, system, and sysbackup volumes, 
LVM on RAID, and filesystems on LVM, for user and operational data.)

After setting up the partitions, the hard part, it's simply creating the 
filesystems and copying stuff over after that.  As for many of my 
sysadmin type tasks, I use mc, aka midnight commander, for the copying.  
Its defaults preserve ownership/permissions/etc and "just work" when 
exotic stuff like symlinks, sockets and device nodes are encountered, so 
no worrying about getting everything right.  The exception is stopping at 
the filesystem boundary if appropriate, but a well chosen mount layout 
minimizing recursive mounts on mounts minimizes that issue, and for 
filesystems such as root, there's mount-bind.  (I actually have a 
rootbind mountpoint and an entry in fstab for it, so all I have to do is 
mount that entry, and copy from it instead of from / itself, to eliminate 
worries of copying more than the root filesystem.)

IOW, the hard part is simply deciding on the new layout I want and doing 
the partitioning (and raid creation) as appropriate.  After that, as with 
the backup discussion recently, I simply copy the data from one place to 
the other, as I would do any other routine copying, so after the 
partitioning and etc. setup, it's pretty much just a routine backup copy 
operation from my perspective.  If there are locking issues, I've never 
seen them, so it seems they only apply to databases and the like.  Of 
course, I'm not trying to copy partitions whilst simultaneously copying 
CD/DVD sized images around on the partition I'm copying, either, but that 
would just be stupid.

I've actually done this for years, so it works.  As I mentioned in 
passing above and have noted before, I had two drives go out at almost 
exactly the 1-year mark (the last one due to overheating due to a failed 
AC), the reason I went with RAID this time.  The RAID has been up and 
running almost two years now, however, and I recently decided to update 
my backups then boot to them and delete and recreate my normally working 
copies, thus effectively "defragging", as I imagine the constant 
upgrading especially the system/root filesystem had well fragmented 
things and I had been routinely replacing the backup images but working 
from the same working copy main image, without defragging or anything.  I 
think I noticed a good increase in system responsiveness, but I didn't do 
any benchmarks or whatever to test, so it could be placebo effect.  Of 
course, the transfer to backup and then rewriting my main/working copies 
went without a hitch as it has always gone, but the point is that both 
the backup and the working copies have been redone "fresh" fairly 
recently and I'm up and running on them without issue, so the procedure 
simply works, and works well.

BTW, for trying to recover data on partially bad drives as I did twice in 
the last five years, dd-rescue works well.  It does direct block by block 
copies just as regular dd does, but it's optimized for bad disk recovery, 
such that when it hits several unreadable blocks in a row, it starts from 
the other end of the image and works backward.  When it hits several in a 
row from that end, it tries to find good spots in the middle between the 
two bad spots, and expands the recovered blocks from there if it finds 
any it can read.  Thus, since the bad-block retries are what takes 
forever in recovery situations, dd-rescue recovers much more data far 
faster than normal dd would, since dd would hit the bad spot and continue 
to try reading block after block in order, with the user likely giving up 
after a few hours or a day or two, possibly before dd reads thru the bad 
spot to the still good data on the other side.  Unlike dd, once dd-rescue 
has been running on an image for a number of hours with only incremental 
progress, the user can be reasonably sure it has recovered pretty much 
all the data that's going to be recovered, so can cancel the operation 
without much fear of leaving still recoverable data on the disk.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

-- 
gentoo-amd64@gentoo.org mailing list



  parent reply	other threads:[~2007-10-06  2:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 20:58 [gentoo-amd64] Cloning a system drive Mark Knecht
2007-10-05 21:14 ` Dieter Ries
2007-10-05 22:46 ` Drake Donahue
2007-10-05 23:07   ` Mark Knecht
2007-10-06  1:00     ` Drake Donahue
2007-10-06 12:22     ` Dieter Ries
2007-10-06  1:53 ` Duncan [this message]
2007-10-06  2:35   ` [gentoo-amd64] " Richard Freeman
2007-10-06  2:43     ` Mark Knecht
2007-10-06 12:47       ` Duncan
2007-10-06 13:16         ` Mark Knecht
2007-10-07  3:58           ` Drake Donahue
2007-10-07  4:49             ` Peter Davoust
2007-10-07  9:33               ` Duncan
2007-10-07 18:34               ` Brian Litzinger
2007-10-08  9:17                 ` Beso
2007-10-08 16:17                   ` Brian Litzinger
2007-10-08 16:28                     ` Mark Knecht
2007-10-08 16:43                     ` Beso
2007-10-08 22:39                       ` Peter Davoust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pan.2007.10.06.01.53.37@cox.net \
    --to=1i5t5.duncan@cox.net \
    --cc=gentoo-amd64@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox