According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
On Sat, 2010-07-31 at 12:59 -0500, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
-- -- Steve
Clonezilla will do a disk to disk clone which is very slick. Which will fit into your 'dd' scenario. If you can do that, then that is the best. Otherwise clonezilla can clone to an image which you know. Also see the fsarchiver application available on systemrescuecd. I've used both with great success. My personal preference is fsarchiver for partitions and clonezilla for full disk.
On 07/31/2010 01:21 PM, Brian Millett wrote:
On Sat, 2010-07-31 at 12:59 -0500, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
-- -- Steve
Clonezilla will do a disk to disk clone which is very slick. Which will fit into your 'dd' scenario. If you can do that, then that is the best. Otherwise clonezilla can clone to an image which you know. Also see the fsarchiver application available on systemrescuecd. I've used both with great success. My personal preference is fsarchiver for partitions and clonezilla for full disk.
The thing that makes this difficult, at least to me, is that LVM is involved.
--- On Sat, 7/31/10, Steven Stern subscribed-lists@sterndata.com wrote:
From: Steven Stern subscribed-lists@sterndata.com Subject: Best way to replace a drive with a clone To: "Community support for Fedora users" users@lists.fedoraproject.org Date: Saturday, July 31, 2010, 10:59 AM According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it?
Best way is subjective :(, There is no "Best way", however there are ways to do it :)
I have the Clonezilla Live CD that I use for backup. Will that do it?
Clonezilla will do it, provided that the new drive is the same size or bigger :)
The "bad thing" might be?, that Clonezilla also copies the "bad sectors" of the original hard drive?, but I am not sure though :(
Or will a straight dd do it?
This could do it, but I would prefer Clonezilla :)
add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
--
-- Steve
Regards,
Antonio
On 07/31/2010 06:59 PM, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
You can resize the FS later to occupy the whole partition. It's worth doing an fsck first.
Alternatively, a recipe I always use to copy a partition is:
cd /newfs dump 0f - /oldfs | restore rf -
This duplicates all the files, but onto a clean new filesystem.
Andrew.
On 07/31/2010 08:16 PM, Andrew Haley wrote:
On 07/31/2010 06:59 PM, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
You can resize the FS later to occupy the whole partition. It's worth doing an fsck first.
Alternatively, a recipe I always use to copy a partition is:
cd /newfs dump 0f - /oldfs | restore rf -
BTW, you should either do this in single user mode or with the fs unmounted or readonly.
This duplicates all the files, but onto a clean new filesystem.
Andrew.
On 07/31/2010 02:18 PM, Andrew Haley wrote:
On 07/31/2010 08:16 PM, Andrew Haley wrote:
On 07/31/2010 06:59 PM, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
You can resize the FS later to occupy the whole partition. It's worth doing an fsck first.
Alternatively, a recipe I always use to copy a partition is:
cd /newfs dump 0f - /oldfs | restore rf -
BTW, you should either do this in single user mode or with the fs unmounted or readonly.
This duplicates all the files, but onto a clean new filesystem.
Andrew.
I like that. Thanks.
On Sat, 2010-07-31 at 12:59 -0500, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
What I normally do is boot the system e.g. with the Fedora install CD in rescue mode, which automatically mounts the old system, and then I
1. partition new drive 2. format partitions on new drive 3. mount new filesystem tree in e.g. /mnt/newroot 4. run # rsync -au /mnt/sysimage/ /mnt/newroot/ 5. edit fstab in new etc to reflect new partitions 6. install grub on new drive 7. unmount and reboot
This way you can easily change the sizes of partitions and also their file systems, which can be handy if you want to take advantage of new file system features. And, you only copy the data, not empty space (I don't think dd does this, although smarter tools should do it).
Also, if you're running SELinux run # touch /mnt/newroot/.autorelabel before rebooting, since rsync doesn't preserve security contexts..
On 07/31/2010 03:21 PM, Jussi Lehtola wrote:
On Sat, 2010-07-31 at 12:59 -0500, Steven Stern wrote:
According to the SMART stats, the single drive in my Fedora server is starting to fail. Rather than backup, do a clean install, and rebuild, I'd like to try to clone the existing drive to a new one, then swap in the new one.
What are the restrictions on doing this and the best way to accomplish it? I have the Clonezilla Live CD that I use for backup. Will that do it?
Or will a straight dd do it? add new drive as PATA slave /dev/sdb dd -if /dev/sda -of /dev/sdb remove /dev/sda change the jumpers on /dev/sdb to match what was /dev/sda reboot
In the dd procedure, I'm not sure what to do if sdb is larger than sda.
What I normally do is boot the system e.g. with the Fedora install CD in rescue mode, which automatically mounts the old system, and then I
- partition new drive
- format partitions on new drive
- mount new filesystem tree in e.g. /mnt/newroot
- run # rsync -au /mnt/sysimage/ /mnt/newroot/
- edit fstab in new etc to reflect new partitions
- install grub on new drive
- unmount and reboot
This way you can easily change the sizes of partitions and also their file systems, which can be handy if you want to take advantage of new file system features. And, you only copy the data, not empty space (I don't think dd does this, although smarter tools should do it).
Also, if you're running SELinux run # touch /mnt/newroot/.autorelabel before rebooting, since rsync doesn't preserve security contexts..
Cool. Thanks.
On Sat, Jul 31, 2010 at 3:21 PM, Jussi Lehtola jussilehtola@fedoraproject.org wrote:
Also, if you're running SELinux run # touch /mnt/newroot/.autorelabel before rebooting, since rsync doesn't preserve security contexts..
Just use "rsync -aAHX" instead of "rsync -au" and you don't have to worry about an autorelabel (rsync will properly preserve selinux labels if you give it the correct flags).