LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-30-2011, 12:35 PM   #1
reubanks
LQ Newbie
 
Registered: Jan 2011
Posts: 9

Rep: Reputation: 0
Fedora 11 takes several tries before successfully booting


I have a Fedora 11 distro running on a desktop machine. It has always reported a hard disk may be failing but have not had trouble with it for over a year. This past week, I had to reboot the machine and it took several tries before it succeeded. How can I replace the offending drive and save my current software installations and data?

Thanks for any help.
 
Old 01-30-2011, 01:50 PM   #2
serafean
Member
 
Registered: Mar 2006
Location: Czech Republic
Distribution: Gentoo, Chakra
Posts: 997
Blog Entries: 15

Rep: Reputation: 136Reputation: 136
Assuming you have no data corruption, it could be as easy as tarring (zipping) up the filesystem and then expanding it on the new disk (if you want a storage of the backup somewhere) or simply copying : cp -a (all this from a liveCD of course. Personnally I'd do it with the dd command, however I haven't yet fully understood what it does with different sized partitions.
Here is a nice article about what you want to do.

Serafean
 
Old 01-30-2011, 01:51 PM   #3
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
This is pretty easy to do. I like to boot a live Linux CD in order to avoid backing up some files that are created at system startup. My method can either back up a system to an intermediate drive or you can use it to copy the existing system directly onto the replacement disk drive. Either way I would use a live Linux CD to do the work.

Some people would use Clonezilla. I haven't tried it yet but it sounds promising. I will show you my method.

This method only explicitly details copying one partition. Copying multiple partitions uses the same principles which can be applied to copying as many partitions as exist on the original disk.

I don't know what level of detail you require so I will start with general steps. I may use this opportunity to create my first LQ blog entry to describe this process in detail. Anyway, here we go!

On a desktop machine you can directly connect the replacement disk drive to a cable attached to the motherboard's disk controller. A notebook/laptop computer would require the use of an adapter to make the replacement SATA disk drive available through a USB port.

If copying directly to the replacement disk drive do this:

1) Connect the replacement disk drive to the computer.

2) Boot the System Rescue CD. (http://www.sysresccd.org/)

3) Use cfdisk to create the partitions on the replacement disk drive.

4) Use dd to copy the boot code of the MBR on the original disk to the MBR of the replacement disk. (440 bytes!)
Code:
dd if=/dev/sda of=/dev/sdb bs=440 count=1 conv=notrunc,noerror
5) Use mkswap to format the swap partition on the replacement disk. (If you have a swap partition)

6) Use mkfs to create the root file system on the replacement disk.

7) Mount the replacement disk's root file system on /mnt/backup

8) Mount the original disk's root file system on /mnt/windows

9) Change directory to /mnt/windows

10) Use tar to copy all of the files from your current directory to the /mnt/backup directory.
Code:
tar c . | tar --directory=/mnt/backup -xvp
11) Remove the original disk. Connect the replacement disk to the correct cable connector or whatever so that the motherboard BIOS will automatically boot from it.

Last edited by stress_junkie; 01-30-2011 at 01:58 PM.
 
1 members found this post helpful.
Old 02-01-2011, 06:53 PM   #4
BoraxMan
Member
 
Registered: Apr 2010
Posts: 103

Rep: Reputation: 11
Quote:
Originally Posted by stress_junkie View Post
This is pretty easy to do. I like to boot a live Linux CD in order to avoid backing up some files that are created at system startup. My method can either back up a system to an intermediate drive or you can use it to copy the existing system directly onto the replacement disk drive. Either way I would use a live Linux CD to do the work.

Some people would use Clonezilla. I haven't tried it yet but it sounds promising. I will show you my method.

This method only explicitly details copying one partition. Copying multiple partitions uses the same principles which can be applied to copying as many partitions as exist on the original disk.

I don't know what level of detail you require so I will start with general steps. I may use this opportunity to create my first LQ blog entry to describe this process in detail. Anyway, here we go!

On a desktop machine you can directly connect the replacement disk drive to a cable attached to the motherboard's disk controller. A notebook/laptop computer would require the use of an adapter to make the replacement SATA disk drive available through a USB port.

If copying directly to the replacement disk drive do this:

1) Connect the replacement disk drive to the computer.

2) Boot the System Rescue CD. (http://www.sysresccd.org/)

3) Use cfdisk to create the partitions on the replacement disk drive.

4) Use dd to copy the boot code of the MBR on the original disk to the MBR of the replacement disk. (440 bytes!)
Code:
dd if=/dev/sda of=/dev/sdb bs=440 count=1 conv=notrunc,noerror
5) Use mkswap to format the swap partition on the replacement disk. (If you have a swap partition)

6) Use mkfs to create the root file system on the replacement disk.

7) Mount the replacement disk's root file system on /mnt/backup

8) Mount the original disk's root file system on /mnt/windows

9) Change directory to /mnt/windows

10) Use tar to copy all of the files from your current directory to the /mnt/backup directory.
Code:
tar c . | tar --directory=/mnt/backup -xvp
A better option is to use, if possible, rsync.

rsync -ahHAX /mnt/source /mnt/destination



Rsync preserves permissions, and if you have to interrupt it and start again, it will continue where it left off. So if it fails, you don't lose anything (unless your hard drive is truly cactus). Rsync essentially runs until the source and destination are the same, so if you're interrupted, or if you have to start again mid file, rsync will take care of it all.

Dump is also excellent, and is duplicates ext2/3/4 file systems exactly, including all file attributes. Use
dump 0f - device | restore rf -

where device is the partition, eg /dev/sda5. Run it in the directory you want to restore too.
[/QUOTE]




11) Remove the original disk. Connect the replacement disk to the correct cable connector or whatever so that the motherboard BIOS will automatically boot from it.[/QUOTE]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
where to go after booting successfully ? harys DamnSmallLinux 2 02-11-2006 03:09 PM
where to go after booting successfully ? harys DamnSmallLinux 1 02-11-2006 07:39 AM
booting takes too long eye Red Hat 5 10-22-2003 01:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration