----Edited 5 Oct 09 - Confirmed the method has been successfully applied to 32 and 64 bit version of Win7 and on SSD hard disk. No problem encountered as expected.
----Edited 22 Jun 08 - A reference to a thread on resizing and moving Xp and Vista added.
----Edited 20 Oct 07 - An example of cloning a hard disk with XP, Vista and 10 Linux has been added in Post #36 ------------------------------
----Edited 21 Oct 07 - The recommended block size changed from 32768 to 32256 making it easier to end up with a full record in the last transfer ------------------------------
Summary ( for regular Linux users)
Step 1 – use Linux dd command to clone the original disk to the new bigger hard disk
Step 2 – use Gparted or Parted Magic to resize the partitions to absorb the extra space Optional only if you want to increase the partitions sizes.
Resizing and moving Xp and Vista partitions are harder than cloning these operating systems because the partition table is changed and the hard disk addresses/locations altered. This thread (http://www.justlinux.com/forum/showthread.php?threadid=151679) gives some pointers on how to go about them.
-----------------------------------------------------------------------
The following has been written for PC users new to Linux
With hard disks getting bigger in capacity and selling cheaper per Gb many PC users can now afford to upgrade the hard disk to a bigger unit. Migrating an operating system to a different hard disk can be hazardous because the integrity of the filing system and the boot loader may be affected in the new home. However if the basic rules are adhered to then the migration can be effortless.
This thread is written to show how to use a Linux Live CD, of either Gparted or Parted Magic, to clone from a smaller source disk into a bigger target disk. Both Gparted or Parted Magic are now available as free downloadable bootable iso images. Just download any one of them, burn the iso into a bootable CD and you are in business. There are other Linux Live CD that can perform the task too but I concentrate on the above two because they are most user-friendly to non-Linux users, have a graphic desktop showing the hard disk partition on a boot-up and the root privilege (Admin. Right in MS systems) is given automatically.
If you don't need the cloned disk to absorb the extra hard disk space then any Linux Live CD can do the cloning job because the operation requires essentially just one line of dd command, as shown and fully explained in Step (5) below.
The operating system type to be migrated is irrelevant and so is the number of them. I often clone hard disk with the Linux-permit-maximum of 63 partitions with 62 different operating systems inside (one less because an extended partition cannot hold an operating system).
How reliable is the migration?
It is both watertight and bomb-proof technically as far as I am concerned. The migration comprises of two parts
(A) The existing hard disk is cloned as a mirror image onto the bigger target disk. This is done by “dd” command available in Unix and Linux. The binary pattern of the original disk is read and then the information is written on the new bigger hard disk, in block size as specified by the user until the number of records in source disk is exhausted. Since it is the binary pattern of the hard disk being copied at the hardware level and so no filing system is involved and there is no need to mount the partitions/disk. Therefore the type and the number of the operating systems in the original hard disk is immaterial. In PC standard the first sector of the hard disk is the Master Boot Record (MBR). Inside it is the partition table. This information is faithfully duplicated onto the new bigger hard disk and so the boot loader will be exactly same as before and be able to load its operating system in exactly the same hard disk address. The operating system that carries out cloning is from a Linux Live CD which is self sufficient. The to-be-clone operating system residing inside the hard disk is undisturbed.
(B) The extra capacity in the newly cloned bigger hard disk automatically becomes unallocated space. The reason I suggest Gparted or Parted Magic is because they can reliably resize NTFS partitions and naturally many of the standard partition types used by Linux. On partitions not supported by Gparted or Parted Magic, like those from BSD and Solaris, the user will have to go to the operating system to alter the partition boundaries. The new MS Vista has its own resizer program inside and it is recommended to use it because the new Vista conducts a check on the partition table on every boot up and will refuse to boot if a user carry out the change without its knowledge.
The procedure below has been tried on migrating a Pata/IDE disk to Sata disk and vice versa. Equally it works seamlessly from an internal disk to an external disk.
Steps (using migration of a XP disk as an example below)
(1) Hardware connections – Here I assume the original disk is inside the PC as an internal hard disk. For easy operation at the expense of slower cloning speed the bigger hard disk can be put into an external hard disk enclosure and offered to the PC via a USB cable or firewire connection. There is no need to do anything with the new bigger hard disk and I often just cut off the seal envelope and hook it up as a raw disk. As soon as the first sector is cloned the new disk will have the partition table of the original disk and all previous information on the new bigger hard disk will be gone. Thus formatting or creating partitions in the new disk is a waste of time.
Pata disk has a jumper for setting it to Master, Slave or Cable select. I recommend “Cable select” because such setting allow the same disk to work as a master or a slave according to connection to the end and middle plug respectively. Once set the disk does not need to be altered again. All my 30+ hard disks were set to cable select and I use them in either as master or slave and internally or externally.
Sata disks have no master or slave setting and the order depends on the physical port location on the motherboard.
(2) Boot up the Parted Magic or Gparted Live CD – It is a Linux Live CD that can run wholly on a CD without being installed into the hard disk. On a boot up you will automatically be given the admin right. A graphic desktop will appear to show the 1st hard disk of your PC. You can see other hard disks, including those attached to the USB ports by clicking the choices available.
(3) Identify the hard disk names (1st line of defence against making an error of the source disk for a non-Linux user) – Basically you are cloning one hard disk to another so knowing how Linux names the hard disk is vital. Linux called Pata/IDE disks as had, hdb, hdc or hdd. A PC can have a maximum of 4 such devices. The SCSI/Sata/USB disks are called sda, sdb, sdc,sdd, sde, sdf…and so on and there can be 16 of such devices. You should be able to know which disk you are looking at by the information of the partitions displayed on the screen. A raw hard disk will have no partition inside.
(edited - Since this thread was published Linux with kernel 2.6.20 and newer employ libATA driver to detect hard disks. As a consequently all SCSI, Pata, Sata and USB hard disks are now called sda, sdb, sdc, sdd, sde....etc)
(4) Identify the hard disk names one more time (2st line of defence against make a mistake on the source disk) – You will then click the terminal icon to get into the terminal mode to execute the cloning process. Before the cloning starts you issue this command in the Linux terminal
fdisk –l
The above command instructs Linux to display every partition of every disk it can find in the system. Pay particular attention to the partition type as Type 7 stands for the NTFS filing system normally used by XP. (For a complete break down of 100+ partition types supported by Linux you can run the fdisk program on any hard disk by command like “fdisk /dev/had” and then select “l” to list the partition type.)
Make sure you know the input device or the original disk where XP is residing.
(5) The cloning process – The Linux command to carry out the cloning is
dd if=/dev/hda of=/dev/sda bs=32256
The cloning is done by the command “dd” which stands for data dump. The “if=/dev/hda” is the input file from device “hda”. Similarly the “of=/dev/sda” is the output file to device “sda”. It is vital that you should have the original disk, containing the XP, in the input device and the target disk is indeed the one you want to migrate XP it.
Linux “data-dumps” the binary pattern it reads from the input device and then writes on the output device using the block size specified. The “bs=32256” represents one complete track of 63 sectors each with 512 bytes. This is about the optimum in my experience with the hardware I have. Omitting the bs parameter will cause dd to default to 512 bytes in each transfer and can slow down the process significantly.
There is no information showing the progress but the flickering hard disk LED is the only indication that the Linux is busy in the cloning process.
When dd completes the task it always reports the number of records transferred. This number multiples with the block size should correspond to the capacity of the source disk (the one with XP inside).
Cloning speed with say a AMD Athlon +3000 will be around 45 to 55Mb/s if both disks are internal. If one disk is an external USB device the speed can drop to between 1/3 and 1/5. Thus cloning a 100Gb internal disk onto a USB hard drive, say at 10Mb/s speed, should be around 2.8 hours. If the target disk is hooked internally, even on a temporary support, the time taken can be reduced to less than an hour.
(6) How to use the cloned disk – Just power down, remove the source disk, put it away for safe keeping as the backup, install the cloned disk in its position, boot up the PC and start using the cloned XP straight away.
If the original disk is not removed then it must be relocated and not used for booting at the new location because it will not boot. Instead the cloned drive, hardware wise, should take over the original disk position because it is supposed to work as the original disk except with a bigger capacity of space.
XP has a protection mechanism that will discover the recorded hard disk serial number no longer matching the cloned disk. It would demand an immediate reboot so that this record is updated. On a reboot XP will work normally again. M$ does allow a XP user to change disk which, being an electromechanical item with moving parts, can break down in time.
If anything goes wrong in the cloning process your original input device is intact because it is used only for the reading purpose. Thus you can repeat the process as many times as needed to get things right. I never need to clone a hard disk twice unless I need a third copy.
The original disk can be later wiped clean to be used as a second hard disk after you have satisfied that the cloning has been 100% successful.
(7) How to use the extra capacity of the bigger hard drive – Run the Parted Magic Live CD again. You can move a partition around and resize its boundary to absorb the extra hard disk capacity. It is recommended the moving of the partition to be done separately, the PC rebooted and the XP is verified working properly before its boundary is resized.
As the residing operating system is not disturbed therefore the above procedure is also suitable for salvage an unbootable hard disk, keep the original copy as back up and carry out repair work on the cloned copy. dd also has parameter to allow a user to slow down the hard disk read/write speed, by altering the DMA mode say from ATA133 to ATA66, to improve the reliability of the data retrieval from a dying disk.
Parcival
05-18-2007, 10:17 AM
Once again we can observe the master at work. :)
On a sidenote: don't you have to go through activation hell again when you migrate Windows to a new disk?
saikee
05-18-2007, 11:04 AM
The main point of my thread is there is no need to reactivate XP or Vista again.
edited 21/7/07 - On Vista my experience is mixed as the copy I have is an early free downloadable version. Its behaviour is erratic. The cloned copy said "activated" but gave out warning "activation expired" later.
I assume the original copy has been activated. When the carbon copy is booted either XP or Vista will find its recorded hard disk serial number no longer matches the one in the new home and a message will be displayed demanding an immediate reboot, otherwise the new disk is not ready.
Once rebooted the record is updated and the new cloned copy is as good as the original.
A hard disk can fail and so both XP and Vista permit the hard disk the OS resides in to be changed. The original copy is hardware specific and cannot be used outside the PC from which it was installed. Since only one OS can be booted at any one time the arrangement is legal if the original is used for the backup purpose.
Many Raid systems do have two identical XP or Vista running on two separate disks permanently.
I do believe the procedure in spirit and substance does not violate the vendor's right because the cloned copy can never used elsewhere except on the original PC. What it gives is the flexibility to the users to have bootable backup copy 100% mirror image of the original at time of cloning. The backed up copy, with all the installed programs and data, is good for something to fall back on should the cloned disk be virus-infested, suffer a hardware failure or the system become unrepairable.
I want to put up this thread because that is a good example demonstrating how simple, useful and yet powerful Linux is. Every user will have a need to migrate to a bigger hard disk some times and this can be achieved by one of oldest terminal command in Linux, a Live CD and a reliable resizing tool in the form of gaparted or Parted Magic. The author of the latter is of course a member of JL. He is the one that did the hard work. I only tell others how it can be used.
chilifries
07-01-2007, 02:24 AM
Question: Is this possible to do with partitions? e.g.
dd if=/dev/hda1 of=/dev/sda1 bs=32768
I ask because I'm trying to move my Vista install from a bigger hard drive (160gb) to a smaller hard drive (120gb), but Vista is installed on a 60gb partition of the bigger drive.
Thanks in advance.
saikee
07-01-2007, 03:20 AM
You can always dd a partition in Linux. If the cloned copy doesn't boot the problem is the protection system by MS systems trying to prevent such a move.
The second link in my signature was written for doing it with a Xp. I have done it with Vista too but cloning the whole disk is a much more reliable move.
If you have to do it with a partition and knowing Vista checks the partition table every time it boots then you should have only one Vista partition in the disk and shift it to the very beginning, using Vista's own internal resizer program. This makes the partition table clean and simple with only entries in the first slot of sda1. The only difference between the two disks is the size of the unallocated empty hard disk space.
I cannot vouch it will always work but that would be the way I would do it. Also as a single partition you can use Vista's installation CD to do repair on the cloned copy as most likely it would work again if you restore its MBR which is unique for Vista. Prior to Vista XP's MBR can be restored by a Dos bootable floppy.
It is a bit irritating for having to learn how to make a bootable copy of Vista for a back up because it is not a useful knowledge of technical advancement except for overcoming artificial barriers erected by the software vendor. Thus I am not a big fan of Vista and believe a user can waste a lot of his/her time on learning useless computer knowledge that would become obsolete when the software vendor brings out another new system periodically to boost his profit.
-----------------------------
Latest
I have cloned a Vista from a 500Gb disk into a 300Gb disk and described it in the Post #55 of this thread (http://www.justlinux.com/forum/showthread.php?t=134457&page=4)
chilifries
07-03-2007, 02:15 AM
So I went ahead and migrated my vista install from a bigger hard drive to a smaller hard drive.
/dev/sda = 160gb hard drive
/dev/sda1 = 60gb vista partition
/dev/sdb = 120gb hard drive
Ran "dd if=/dev/sda of=/dev/sdb bs=32768" and after 45 minutes or so gave me a "disk full" error. Removed my 160gb drive and rebooted using just my new 120gb drive. Vista booted up fine and I used Vista's disk management tool to "expand" the 60gb partition to the full 120gb.
Every thing's working fine, except that I had to re-activate my vista install.
Thanks again for the guide.
saikee
07-03-2007, 04:47 AM
chilifries,
Did your source disk have one 60Gb partition holding Vista with the remaining 120Gb as unallocated free space?
If it wasn't then the cloned disk sdb would have a copied partition table, from sda, indicating the partition boundary at 160Gb. Since in the target hard disk sdb is physically 120Gb large that would cause all operating systems, including Vista, to refuse to handle it.
The re-activation may be to do with its standard booting check on the partition table has been enabled. I often switch it off if the entries in the partition table is going to be altered. Vista protects itself by checking with a backup copy of the system setting and that should be disabled if the OS is to be cloned to a different environment.
I didn't need to re-activate mine in the link indicated in Post #5 when changing it into a smaller disk.
Anyway glad to see it worked out for you.
chilifries
07-03-2007, 04:09 PM
Did your source disk have one 60Gb partition holding Vista with the remaining 120Gb as unallocated free space?
Yes. After swapping the drives, Vista correctly saw that the 120gb drive had a 60gb primary partition and 60gb unallocated free space.
asmith
07-07-2007, 04:28 PM
I am attempting to move a 32-bit Vista partition from a PATA to a SATA partition. Both are formatted to 30gb (the destination partition is a few KB bigger, so it's fine if that space gets lost).
The problem is that I do not have a Linux partition installed, though I do have an XP partition. All three partitions mentioned so far are on different physical drives, each containing other partitions that I don't want to touch.
What tool can I use to make the swap? After a successful migration I would like to format the origional PATA Vista partition (what I'm using right now), so that need not be made to work alongside the eventual SATA Vista Partition.
A seemingly elegant solution would be to do the migration with DD for Windows, disconnect the current PATA Vista partition, boot and let the Vista DVD fix the MBR when it sees nothing but a SATA version of Vista.
Think that will work? From what environment (XP, Vista partition that's being copied, boot to Vista recovery console) will DD for Windows be able to do what it needs to do? Was all this typing in vain seeing as this is a Linux site? (:eek:)
DD for windows: http://www.chrysocome.net/dd
If anyone can give me some advice I would be very appreciative. The drive I'm trying to move away from is on its last legs.
saikee
07-07-2007, 06:25 PM
asmith,
Welcome to JustLinux.
I haven't used dd for Windows so I could not comment on its success but there a few things I can clear up.
(1) The suggestion I put forward in this thread is to use a Linux Live CD which run on a CD and does not need to be installed into the hard disk. Therefore you are using another operating system and the Vista is cloned just as a normal data partition. This is essential as software like Norton Ghost need to reboot and come back using a DrDos program to do the cloning work.
(2) Vista checks the partition table against a copy it keeps. To have successful result you need to keep the partition order and the number of partitions and their boundaries as similar as possible. If you clone a Vista from the first partition of one disk to a second partition of another disk I can tell you right now it will not work.
Implicit in my suggested cloning from a smaller hard disk to a bigger hard disk is that you are guaranteed to end up with an identical partition table on both disks. That is an important hurdle to cross.
(3) The reason why dd is used is because it operates on a partition's boundary using the hard disk addresses stated in the partition table. This means the boot sector, which is outside the filing system, is also cloned and therefore the cloned copy has to be bootable. I am not familiar with the partition convention in Windows so I could not be certain it does the same thing but using the word "dd" means it must be able to do that. In Linux the hard disk partitions are name sda1, sda2, sda3 etc and so the device names can accurately define the boundaries of every partition. If you have 3 disks they should be named sda, sdb and sdc.
Although this is a Linux forum but I can assure you that every Windows user is welcome too. It just that our experience and know-how are invariably linked with Linux. I do have to use Windows for work.
Cloning Vista or XP by a partition is tricky. The success rate by cloning the whole disk is more assured. The problems , pitfalls, cloning instructions and things you need to watch out for a partition is simply not worth the bother. My last cloning was from a 500Gb Sata to another 500Gb Sata and it only took 2.17 hours.
asmith
07-07-2007, 07:25 PM
Thanks for the quick response saikee.
(1) Any suggestions on a good Linux live CD? Minimal configuration would be nice since I'm only trying to do one quick thing with it.
(2) I would be cloning from a first partition to another first partition, so hopefully there are no problems there.
Figuring out what I need to know about sectors and blocks and that sort of low level hard drive stuff is a little bit confusing. Could you help me understand what parameters I would need to give DD or point me to a relevant online resource?
chilifries
07-08-2007, 01:03 AM
The GParted Live CD (http://gparted.sourceforge.net/) will do nicely, since you can use it to resize partitions at a later time if you want.
Also do check out saikee's post (#55) here (http://www.justlinux.com/forum/showthread.php?t=134457&page=4).
MkIII_Supra
07-08-2007, 01:17 AM
I have my Linux install spread across two hard drives?
My root partition and swap is on an 80GB SATA drive (which I don't want to move...)
and my home partition is on a 120GB SATA drive.
I am considering upping the 120GB to a 400 or even 500GB drive and I want to move my home to it. Same process?
saikee
07-08-2007, 07:38 AM
MkIII_Supra,
I never need to do cloning with Linux partitions myself.
The mod here has taught me using tar. Here is what I would go about getting a 120Gb /home into a 500Gb disk
(1) Boot up the existing Linux
(2) I am assuming the 500Gb disk starts as a raw disk and has a name , say sde. I would use cfdisk (or fdisk if you are using a Red Hat) to create a partition sde1 for the whole disk or a size of my choice. It should automatically Type 83 native for Linux. A reboot is unnecessary but doing one is a good practice if you can afford the time.
(3) I would then format the sde1 to the filing system of my choice and then manually mount it by terminal command in root
mkdir /mnt/sde1
mount /dev/sde1 /mnt/sde1
(4) The tar instruction I learned from the mod is
cd /home
tar cf - . | ( cd /mnt/sde1; tar xf -)
The tar command will copy the entire content of the current partition (that I have changed directory to), inculding all settings of ownership to /mnt/sde1.
(5) I would now check the content of /mnt/sde1 and satisfy myself everything is there. Then I would edit /etc/fstab to mount the /home to sde1
On a reboot I should have my home in the 500Gb disk environment. After a short period of usage and convinced the /home is working perfectly I shall use the 120Gb disk for another purpose.
The cloning procedure of Post #1 can be used too but you have to resize the partition after the cloning operation. It has the following disadvantges
(a) You clone every bit of the the entire 120Gb including unused and empty spaces. Tar only moves files and empty spaces are left behind so it is much faster.
(b) You have to resize the partition from 120Gb to 500Gb. Tar transfer the files from 120Gb to 500Gb naturally.
The cloning is only necessary if the OS has a protection mechanism or a rigid arrangement for retrieving its system files. Linux partitions do not fall into that category and so the normal Linux commands are good enough to move Linux systems from partition to partition and from hard disk to hard disk.
I include Linux in my title mainly because I clone disks with many operating systems inside.
Personally I rarely resize a partition for Linux. I enjoy the teaching by the mod and it gives a kick every time I use it. To me that is what Linux is all about ---> a rich set of Command Line Interface (CLI) that is superior to other OSs.
I use tar, exactly the same instructions as above except cd to /mnt/sdax instead to /home, to move the entire Linux which I always installed in a single partition. When needed I mount an additional data partition.
bacon12
07-09-2007, 06:48 PM
A little word to the wise for those with little or no experience with dd. It is a very powerful command and you need to make extra sure your syntax is correct.
saikee
07-09-2007, 07:57 PM
An understanding of dd command is important but dd itself is a simple operation of
(1) Read the "1" and "0' of the input device and write the same on the output device. The default packet size is one sector of 512 bytes unless specified otherwise by the user with the bs parameter.
(2) The starting and finishing points will be defined by the input device. This is to say from the beginning sector to the last sector of the input device.
This thread was written for the input device as one whole disk holding the original information and the output device is another spare disk larger in size. This is a lot safer than cloning a partition or a file.
As long as the input device is correctly identified then it will only be used for reading purpose. Any error in the rest isn't going to be critical. I have put in Step (3) and (4) in Post #1 purely as extra precautions for 1st and 2nd lines of defense against mistakes in choosing the wrong source disk.
I would recommend before hitting the return key a user should shout at the top of his/her voice for
dd if=/dev/hda of=/dev/sda bs=32768
data dump using input file equal to device hda, output file equal to device sda and block size 32768
The block size can be omitted but the operation takes a lot longer.
chilifries
07-11-2007, 12:16 AM
A little word to the wise for those with little or no experience with dd. It is a very powerful command and you need to make extra sure your syntax is correct.
They don't call it data destroyer for nothing. heh.
asmith
07-13-2007, 11:34 PM
I found an excellent solution and have successfully moved a PATA Vista partition to a SATA partition. Making sure to boot for the first time with no other drives connected which could cause the new Vista partition not to call itself "C:\" was critical.
It apears that there are similarities to the method described in this thread
e(1) Vista installation DVD is being used as a Live DVD. An operating sysytem is "sourced" from the outside and the operating system residing in the hard disk is not booted.
(2) The Vista Live DVD is used as a utility just for the cloning process.
(3) All hardware has to be keep unchanged so as not to contradict setting discovered by Vista .
(4) Depending on the cloning process it is some times necessary to repair/restore the Vista's MBR (reported by the user). This apparently applies to both methods.
Then there are the following differences
(a) Vista Live DVD clones a system by copying its files (several users reported omission of files after the process). Linux Live CD clones a partitions/disk by just the binary bits (of "1" & "0"). Thus Linux Live CD can clone any system whereas Vista Live DVD clones only the filing system it supports.
(b) Vista Live DVD clones an operating system with several commands necessitating the creation and formatting of a partition.
LIST DISK (Shows the disks attached)
SELECT DISK 0 (Selects the first disk)
LIST PARTITION (Shows the partitions on the first disk)
CREATE PARTITION PRIMARY (Creates a new primary partition on the first disk)
LIST PARTITION (Shows the partitions, and now there is one)
SELECT PARTITION 1 (Selects the newly-created partition)
ACTIVE (Marks the new partition as active, or bootable)
FORMAT QUICK (Formats the partition with NTFS)
LIST VOLUME (Shows the newly-formatted volume)
ROBOCOPY E:\ C:\ /e /efsraw /copyall /dcopy:t /r:0
The color commands are regarded essential while others are optional and can possibly omitted by an experienced user.
The main theme of this thread is simplicity by cloning the whole disk and dd can do it with just one line of command using a disk directly off a sealed raw disk (sda)
dd if=/dev/hda of=/dev/sda bs=32768
even the red bit is optional as it is there just to make the cloning go faster by transferring a bigger block of data each time.
(c) I am not sure if it is necessary but the link indicates the hard drive of the resident MS operating system must be physically removed first in order for Vista not to pick up any change in the hardware when at a later time the system to be cloned is introduced back in an external USB disk.
The Linux Live CD method described here has been applied by me for cloning internal disks, external disks, Sata disks, Pata/IDE disks, 3.5" desktop drives, 2.3" laptop drives in any combination. The resident disk can remain in its original position if required in the cloning process.
The above is not an attempt to sell the method described in this thread but to lay out in the open all the relevant differeces and similarities to let the readers to understand better what is going on behind all these commands and instructions.
I personally welcome any alternative method, especially on backing up a Vista, to place together in one place to enable users to make their choices, and if desired to understand the underlining principles too. So I learn a new thing today myself.
asmith
07-14-2007, 02:24 PM
I would have prefered to use the linux live CD method you described, but I needed to move a partition rather than the entire disk. You voiced concerns about whether or not the DD method would work for moving partitions so I gave the Vista install disk tools method a try.
It was kind of slow, just like Vista installation itself, and clumsy. In the end, I did need to reactivate windows. That process included:
- Windows telling me my original key was "currently in use"
- Calling tech support and dealing with giving/getting a 25 character alphanumeric key to/from a non-native english speaker. Even from a native English speaker that is a pain.
- Windows telling me the new key was "not valid with this version of Windows."
- Being told I would have to call back in an hour and given the "pay per incident" support phone number.
In a few minutes I just tried the automated phone support option in the activation window.
-The "activation ID" (or whatever it's called) I received automatically did not work.
-I was connected to another "technician"
-I only had to give her the first 6 digits of the 48 digit activation ID (phew)
-She gave me a new 48 which finally worked.
Who knows if it's using my new key or my old key, but now I understand why people try everything possible to avoid re-activation.
Legomaniac
08-12-2007, 02:39 AM
saikee first off I would like to thank you for creating such a great tutorial. I am a huge open source fan and people like you are what keep things going.
I recently received a new 120gb sata drive for my laptop and have decided that I am going to use your tutorial method to transfer my existing windows and fedora 6 drive to the more beefy counterpart. The only problem is that I need to move the data first to one of my external drives before I can move it back to my laptop, being as it has only the one singular sata connection.
My problem exists here. I have two external disks, one 250gb and one 400gb. The 250 is full but the 400 has less than 100gbs taken up. Using your tutorial I could transfer the contents of my 250 to my 400 and then use my 250 for the swap, but that would end up being a slight pain as, even though they are USB 2.0 it would add a significant amount of transfer time to take all the data off and slap it all back on after I am done.
I have seen the "Learn the DD command" thread from Awesome Machine on LinuxQuestions.org and noticed that you could use DD to write to a file... I think. It's just although his thread is very useful it seems a little hazy at times and I want to make sure. And even then I couldn't quite find the command it would take to copy the image file to my new disk.
Once again, thanks for your help. People like you make the open source world go round.
saikee
08-12-2007, 10:39 AM
Legomaniac,
You do not need to back up the data before the cloning process. This is because you use the source disk "exclusively" for reading purpose in "if=/dev/hda".
Only the "device" specified in the "of=/dev/sda" will be written on.
Thus you can put the new 120Gb in a 2.5" hdd USB enclosure, boot up Fedora or a Linux Live CD and proceed with the cloning process.
If you are using 2/6/20 kernel or newer the existing laptop disk may be called sda and the new USB disk will be named as sdb. USB disk is always called sda or sdb in your case.
You can clone it with Fedora because the cloning process operates on the hardware level and does not affect the Fedora's mounted filing system.
I recommended to read Post #16 through and be certain of the input device name. No mistake can be made here!
In Open source we can talk about the theory and method openly and share the knowledge. I am only passing the knowledge the mods and members in JustLinux have taught me.
Legomaniac
08-12-2007, 01:34 PM
Thanks for the advice, however my problem isn't backing up the hard drive that currently has my os's on it but using one of my current external drives as a middle man in the swap.
I want to go "current drive -> external drive" then move on to "external drive -> new drive" My only concern is that because dd writes the entire contents of the source disk bit for bit that I would lose my data on the external drive that I chose to use for the process. I could back up the data from the external drive but that would just add a good portion of time to the process.
I guess if I phrase it better my question would be "can dd write to a file so I can leave the current contents of one of my externals untouched?" And then how would I transfer that data to my new drive if it can write to a file?
I just thought I saw something on a different thread that said it could write to a ".dd" file or something of the sort.
I would just go out and buy a 2.5 sata enclosure but I am going to college soon and I need to cut as many corners when it comes to spending as I possibaly can.
Thanks again, your help is invaluable.
saikee
08-12-2007, 03:27 PM
The output file in dd is "of=". You can just name a file there as the recipient of the output destination. I rarely go down this way though because you don't save time and the file is huge because dd does not do compression. You can compress the file afterward with tar or gzip but the file is only good after expansion to its original form.
Legomaniac
08-12-2007, 08:22 PM
Unfortunatly it seems as though my only choice now is to write to a file, then to write back to my new hd.
However, I have hit a roadblock due to my noobishness with linux. I tried to specify the output file onto one of externals but it returned the error "directory does not exist"
Do I need to mount the external I am copying to? How do I give the "of=" the correct path to write the file to one of my external drives?
Sorry for presenting you with what I assume is such a basic question but I tried to find out on my own through some basic linux shell tutorials and failed miserably.
Thanks again.
saikee
08-13-2007, 03:12 AM
You have to mount the external drive, have sufficient room in a directory and specify the absolute path to it, some thing like "of=/mnt/sdb1/backup_Aug_13."
Have alook at Awesomemachine's thread on dd (http://www.linuxquestions.org/questions/showthread.php?t=362506&highlight=learn) too. Plenty of examples there.
irlandes
09-15-2007, 04:57 PM
After I realized I was unable to use an old Compaq 5441 to clone my old 20GB HD into a new Samsung 100GB, (Samsung too big for Bios) I whined a bit, then bought a Maxtor external HD at Wal-mart, $74.
I plugged it into my Dell Inspiron 2650, booted on a Puppy 2.11 live CD, and typed on the terminal: dd if=/dev/hda of=/dev/sda bs=32768 <enter>
Since my Inspiron had USB 1.1 I had no idea how long it would take. Answer: around 6 or 7 hours. It reported:
610470 records in
610470 records out
I checked with fdisk -l and the external HD indeed was a near clone of the 20GB HD.
md5sum /dev/hda f211ffc1f778ab88d72f3e1b94869f60 on original HD.
I then shut down, swapped in the new Samsung into the Inspiron, and typed in:
I did not want the thing to run all the way to overflow, at that slow speed, thus the limit on blocks to known size shown during original clone.
I went to bed, and in the morning the external HD was apparently cloned onto the new Samsung.
md5sum /dev/hda 113fe44165be8fd4a936e133a89471e4 on the new cloned/cloned HD. Not the same. I don't know if this is grounds to worry or not.
I booted on the new clone, and though md5sum is changed, seems to work okay.
I then tried Puppy 2.11 qparted for partitioning. It insisted on making each new partition a primary partition.
Then, I tried qparted in Kubuntu 7.04 Live CD, and it did not give me the choice to format as ext3. Unless I did something wrong?
So, I dug around, could not find 2007 Mandriva install CD, must have left it in Mexico. I did find Mandrake 10.1 install CD, and then partitioned the rest of new HD into 5 more partitions, which will give me room for several distros. Also, 35GB Fat 32, to be used for storage. I used Mandrake/Mandriva since 1999, but they ship too much junk and I finally tired of it. Their install disks are the best partition tool I have ever used, so I keep one around just for that. Just continue install with custom partitioning, until partitions are set and formatted, then hit the power switch and remove install disk.
Anyway, I am using as I type the cloned HD, and soon will be installing new distros.
That 35GB storage, I am going to experiment. I will see if I can move .evolution and kppprc and other config files in there, and when I install a distro which uses one of them, split screen on file browser, and MAKE A LINK where it should go, then use the same file with all distros. And, any changes will instantly be available for all distros.
Well, if it doesn't work, I will have learned something useful.
saikee
09-15-2007, 07:46 PM
I can understand only the first bit.
You were cloning a 20Gb disk, right? The 610470 number of record each 32768 byte long is exactly 20Gb. Say doing it in 6.5 hours averaging 0.854Mb/s or 6.83Mbit/s. That ties in pretty well with USB 1.1 burst speed of 12Mbit/s.
Unless your Maxtor disk is a desktop size of 3.5" I would have expected you to remove 20Gb disk and drop the Maxtor in and use it right away. Instead you use the Maxtor as the source to clone the 100Gb Samsung disk.
Your second cloning will be only successful if the Maxtor is less than 100Gb in capacity.
Anyway it looks you have achieved your aim. So congratulation.
irlandes
09-16-2007, 09:47 AM
Like many things in Linux, this is more complex in the contemplating than in the doing.
It was an external HD I bought, not a HD. It is a one-piece assembly. I suppose it could be taken apart, there are screws. But, I did not need to take it apart. Besides, unless it happened to be a laptop HD inside, (unlikely because they are generally more expensive) it wouldn't plug into my laptop anyway.
Now as far as being limited to an external HD no greater than the HD to be the end clone, that is the wonder of command dd.
Look at the command, and you will see at the end: count=610470 which was derived from the original transfer to Maxtor.
That means when I use the Maxtor as source to clone my new Samsung, it starts the transfer at the beginning, which includes MBR and partition tables, then when it finishes the 610470 blocks (size 32768) it stops.
So, the Maxtor can be 4 TB, if such a thing is possible, and cloning transfer will stop at exactly 20GB.
Also, someone in one of the threads reported that moving data from a larger partition than the recipient, results in a halt and error message that disk is full. In my case, I didn't want the transfer to run another 30 hours just to halt by itself, so I tried the COUNT parameter and it worked perfectly. Of course.
Hope this helps.
irlandes
09-16-2007, 09:52 AM
By the way, this is time to thank you again, Saikee. If it were not for the original thread, which you posted, and the reference link you supplied on my own question, and the follow-up assistance, I would have had absolutely no clue at all.
It is not friendly diplomacy on my part to say it would not have happened without your kind assistance. It is just plain fact. Thanks!
saikee
09-16-2007, 10:29 AM
irlandes,
Thanks for the kind words.
I am passing the knowledge that mods and members have taught me. That is what JustLinux is all about. Wait until you see what our village elders (super mods) can do for you.
I am just one of their pupils.
irlandes
09-16-2007, 10:52 AM
Your comment about being one of their pupils brought back some history. Sorry to digress.
In 1974, I started on the first microprocessor unit in our company. It was based on a Rockwell PPS-4, a 4 bit cash register microprocessor, which we used to make a fine area navigation computer for business jets. And, of course, the Israeli Air Force bought them for their fighters instead of paying $100,000 each as the USAF did.
I was a true pioneer in those days. I was good, and that is no brag. The last time I was especially good in that company.
Sometime later, I transferred to another department, and some of the guys there asked me for an introduction to micro-p's.
Within a few days, those guys were moving on past me. Incredible.
So, being a pupil does not always mean being lesser. Trust me on this.
jsnadml
10-16-2007, 12:51 PM
saikee,
I'm a Linux noob, I started looking at distributions about 4 weeks ago. I've read with great interest your tutorials on booting, cloning, and migrating. I appreciate the time and effort that you put forth in doing this. Following the instructions in your migrating XP to a larger hard disk tutorial I have successfully migrated XP from an 80 GB SATA to a 160 GB SATA. I am currently dual booting that PC (I need to find the LInux equivilant of one Windows program and then I can dump Windows totally).
My second attempt at migrating has been unsuccessful and I'm hoping that you can help. I tried to migrate XP from a 60 GB PATA to a 400 GB PATA. After a few minutes the process stops and I get the below message:
dd reading /dev/hda input/output error
310061+1 records in
310061+1 records out
(10.0 GB copied)
The 60 GB PATA disk has 40 GB in files so more than 10 GB should have been copied. I tried to boot from the new 400 GB PATA but of course it will not. I have done this twice and the error messages are exactly the same both times. The old 60 GB PATA successfully boots XP and has never given an indication of having a problem. Do you have any suggestions or ideas that I could try ?
Thank you.
saikee
10-16-2007, 04:38 PM
jsnadml,
Welcome to Juxtlinux.
I believe dd does not distinguish empty space from files because everything are bits of "1" and "0".
The number of records times the block size should equal exactly the disk size in a successful pass. In your case it looks the disk has some kind of corruption or enough of bad sectors serious enough to prevent the disk from being read continuously.
I do not have a solution for it. You may need to slow down the read access by changing the DMA mode or use a different version of dd like dd_rescue (http://www.garloff.de/kurt/linux/ddrescue/). I haven't had a need to go into such a bad disk myself. There have been a few posts here saying a dead disk could be brough back from life with various tricks.
jsnadml
10-17-2007, 06:53 AM
saikee,
Thank you for the quick reply. I'll try the suggestions that you mentioned.
saikee
10-20-2007, 08:57 AM
Here is an Ubuntu 7.10 Live CD screen message of cloning from a 500Gb eSata disk sda (Seagate), which is physically outside the PC to an internal raw 500Gb Pata disk sdb (Western Digital)
ubuntu@ubuntu:~$ sudo su
root@ubuntu:/home/ubuntu# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 12158 97659103+ 17 Hidden HPFS/NTFS
/dev/sda2 * 12159 24316 97659135 7 HPFS/NTFS
/dev/sda3 24317 36598 98655165 5 Extended
/dev/sda4 36599 60801 194410597+ 83 Linux
/dev/sda5 24317 24438 979933+ 82 Linux swap / Solaris
/dev/sda6 24439 25654 9767488+ 83 Linux
/dev/sda7 25655 26870 9767488+ 83 Linux
/dev/sda8 26871 28086 9767488+ 83 Linux
/dev/sda9 28087 29302 9767488+ 83 Linux
/dev/sda10 29303 30518 9767488+ 83 Linux
/dev/sda11 30519 31734 9767488+ 83 Linux
/dev/sda12 31735 32950 9767488+ 83 Linux
/dev/sda13 32951 34166 9767488+ 83 Linux
/dev/sda14 34167 35382 9767488+ 83 Linux
/dev/sda15 35383 36598 9767488+ 83 Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
root@ubuntu:/home/ubuntu# dd if=/dev/sda of=/dev/sdb bs=32768
15262080+1 records in
15262080+1 records out
500107862016 bytes (500 GB) copied, 8047.02 seconds, 62.1 MB/s
root@ubuntu:/home/ubuntu#
The above show the raw disk sdb has no partition to start with and took 8047.02 seconds, at a rate of 62.1 MB/s transfer rate, to copy 500Gb. The first command "sudo su" is to become a super user, having the root privilege, in a Live CD. The command "fdisk -l" is for checking the disks' partitions. The whole cloning process is done by one line command of " dd if=/dev/sda of=/dev/sdb bs=32768".
Both disks have an identical size of 500107862016 bytes. Since I specified each block size of 32768 bytes in each transfer (by the bs=32768) I therefore should have 15262080.75 records to be shifted. This matches exactly the number of records read and written by dd, which reported 15262080+1 records as the last one was not a complete record.
The partition table after the cloning is
root@ubuntu:/home/ubuntu# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 12158 97659103+ 17 Hidden HPFS/NTFS
/dev/sda2 * 12159 24316 97659135 7 HPFS/NTFS
/dev/sda3 24317 36598 98655165 5 Extended
/dev/sda4 36599 60801 194410597+ 83 Linux
/dev/sda5 24317 24438 979933+ 82 Linux swap / Solaris
/dev/sda6 24439 25654 9767488+ 83 Linux
/dev/sda7 25655 26870 9767488+ 83 Linux
/dev/sda8 26871 28086 9767488+ 83 Linux
/dev/sda9 28087 29302 9767488+ 83 Linux
/dev/sda10 29303 30518 9767488+ 83 Linux
/dev/sda11 30519 31734 9767488+ 83 Linux
/dev/sda12 31735 32950 9767488+ 83 Linux
/dev/sda13 32951 34166 9767488+ 83 Linux
/dev/sda14 34167 35382 9767488+ 83 Linux
/dev/sda15 35383 36598 9767488+ 83 Linux
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 12158 97659103+ 17 Hidden HPFS/NTFS
/dev/sdb2 * 12159 24316 97659135 7 HPFS/NTFS
/dev/sdb3 24317 36598 98655165 5 Extended
/dev/sdb4 36599 60801 194410597+ 83 Linux
/dev/sdb5 24317 24438 979933+ 82 Linux swap / Solaris
/dev/sdb6 24439 25654 9767488+ 83 Linux
/dev/sdb7 25655 26870 9767488+ 83 Linux
/dev/sdb8 26871 28086 9767488+ 83 Linux
/dev/sdb9 28087 29302 9767488+ 83 Linux
/dev/sdb10 29303 30518 9767488+ 83 Linux
/dev/sdb11 30519 31734 9767488+ 83 Linux
/dev/sdb12 31735 32950 9767488+ 83 Linux
/dev/sdb13 32951 34166 9767488+ 83 Linux
/dev/sdb14 34167 35382 9767488+ 83 Linux
/dev/sdb15 35383 36598 9767488+ 83 Linux
root@ubuntu:/home/ubuntu#
I have a XP at sda1, Vista in sda2, sda5 a swap and sda6 to sda15 each has a Linux inside.
The terminal commands are marked in red. The last partition table of disk sdb shows a mirror image of the former disk sda.
For some reason all 500Gb disk of Seagate, Western Digital and Samsung all have the same number of sectors, making cloning a trouble free operation.
I also enclose the buffered read speed of sda (a Sata II) and sdb (a Pata ATA133)
root@ubuntu:/home/ubuntu# hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 8712 MB in 2.00 seconds = 4360.12 MB/sec
Timing buffered disk reads: 198 MB in 3.02 seconds = 65.60 MB/sec
root@ubuntu:/home/ubuntu# hdparm -tT /dev/sdb
/dev/sdb:
Timing cached reads: 8658 MB in 2.00 seconds = 4333.50 MB/sec
Timing buffered disk reads: 214 MB in 3.00 seconds = 71.22 MB/sec
root@ubuntu:/home/ubuntu#
My motherboard see the eSata as a SCSI disk and has it detected first and the Pata disk second.
-------------------------------------------
Edited 20/10/07
I am editing this thread with the Vista in the Pata disk. This Vista is the third clone. I originally installed it, same as XP and 10 Linux in an internal 500Gb (Western Digital) Sata II disk.
I first clone the internal 500 Gb Sata to an external eSata disk (a Seagate Sata II disk physically outside the PC and connected to the eSata port of the mobo). That operation took 9134 seconds at 54.8MB/s. I use Slax a Linux inside the internal disk for cloning.
I then powered down, remove the internal Sata and boot up the eSata as the only disk in the system. The Bios had to select the eSata to boot as it is the only hard disk in the system. All the OSes work as expected.
I then powered downed, add a raw Pata disk (as described at the beginning of this thread) as an internal disk, boot up a Ubuntu Live CD and to clone all the OSes from the eSata back into the internal Pata disk.
I always use mobile racks for my hard disks so pulling one out and insert another in take only a few second.
As I reported in the thread Vista on rebooting first time in the new enviroment immediately discovered its recorded hard disk serial number and details no longer match the newly found hard disk. It reported the new hardware found and demanded an immediate reboot to effect the change. After the reboot everything is back to normal. The activated copies of Vista and XP have been preserved through the two successive cloning processes and in different disk types.
The disk-to-disk cloning by Linux dd command has not produced a single failure in my experience, regardless the number and the type of operating systems I have in the source disk. It works like a clockwork.
----------------------------
Edited 21/10/07
The effect of cloning XP & Vista from
Internal Sata II --> External eSata II --> Internal Pata --> External USB Pata
As a demonstration how easy cloning in Linux dd I cloned the 3rd copy from the internal Pata, as mentioned in the above, to an external USB Pata disk which is a 500Gb Seagate Barracuda (exact size as the others 500Gb disk).
The operation took 27,452 seconds at 18.2MB/s. This is 7.625 hours and took 3.41 times longer. The reason is because from the 2nd to 3rd copies the cloning was done between two internal disks. Between the 3rd and 4th copies one disk is an external hard disk bottlenecked by the USB2.
The Vista and XP did not boot and reboot every time if I try. The 10 Linux only 3 boot successfully while the others report "kernel panic - not syncing". This is expected because Linux installed originally installed in an internal hard disk may not be suitable for booting from a USB port.
So what I gain from wasting 7.625 hours of computer time (during which time I took the wife to watch a movie and had dinner)-----> I removed the hard disk from the USB enclosure, put it into a caddy, inserted it into the mobile rack, powered up the PC and found XP and Vista bootable again.
ir8trader
11-24-2007, 08:07 PM
I wanted to add my thanks for the instructions here. This simple little proceedure took me almost 6 hours, not because the instructions were not clear, but because I did not follow the instructions to the absolute letter. The difficulties that caused me gave rise to a few questions, which I'll ask after letting people know just what did work:
I have a Windows Vista system which had a 40G IDE Drive. I installed a 300G Sata Drive that was to be my new system disk. I tried ubuntu livecd with no luck, it would just hang, I ended up using kanotix livecd which worked with one minor quirk, (It seemed to hang after starting Xwindows with nothing but a black display, I hit Ctrl alt del which all of the sudden brought up the display with a warning window asking me if I was sure I wanted to shut down, I said no and it worked fine after that). I found the system disk, dd'd the disk to the new disk, it worked very quickly, shut down the system, modifed the boot params in the bios to choose the harddrive, modified the boot priority of the hard drives to tell the system to look at the new 300G drive first and rebooted WITHOUT removing the original 40G drive. It booted fine, but it booted from the 40G drive. I then shutdown, removed the 40G drive, rebooted and it failed to boot, it could not find the bootloader. I redid the livecd, dd'd the 40G to the 300G again, shutdown REMOVED the 40G drive and it booted fine.
One other final note. The new 300G drive had a single partition of 40G. I just used the disk management utility in Vista, right clicked on the new partition, selected "extend volume" and simply proceeded through with defaults which expanded my partition to the available disk space. All in all this should have only taken me about 35 minutes max, the proceedure is very simple and very quick, again, many thanks.
Now for my question: What happened when I left the original disk in the system and tried to change the bios to boot from the new disk ? Obviously something happens to the boot records, if you could enlighten me on this I'd be grateful.
and of course... REMOVE THE ORIGINAL BOOT DRIVE BEFORE REBOOTING !!
Oh, and I did NOT need to re-register Vista
Thanks..
crow2icedearth
11-25-2007, 02:26 PM
I basically have been doing this for years but i do it on a LVM external usb disk.
then if i need to access the drive i simply use a live linux cd so i can access the LVM disk and put it on the new drive i need it on.
it keeps it smpiler so i know what each logical volume is . like i would do
/dev/os/gentoo
/dev/os/fedora
/dev/os/windowsxp
and so on
bwkaz
11-25-2007, 07:37 PM
Now for my question: What happened when I left the original disk in the system and tried to change the bios to boot from the new disk ? When you use grub to chainload the XP bootloader, that bootloader reads in its boot.ini file from the first BIOS drive. This wasn't the cause of the behavior you saw, though, since both boot.ini files were exactly the same, but it's critical info. ;)
The cause of what you saw was in the contents of boot.ini. That file tells the NT bootloader to fire up the kernel from a hardcoded set of filenames sitting in a certain directory. You specify the directory in boot.ini by first specifying the disk (in BIOS order, I believe), then the path. Normally this looks something like "multi(0)disk(0)rdisk(0)partition(2)\WINDOWS" for a default XP install.
The "disk(0)" part is the part that got messed up in your case. In your case, the 40G drive was still disk 0, while the larger drive was disk 1. When you removed the 40G drive entirely, the larger drive assumed position 0, and the same boot.ini file booted the system up from it.
(At least, I assume this is the case. I guess Vista has a completely different bootloader or something like that now -- however, I bet it still follows the same set of restrictions as ntldr did.)
saikee
11-25-2007, 10:37 PM
Vista is a proprietary system and it is a feature of the recent MS systems to check integrity of every partition it has to mount. It appears a possibility that Vista will not tolerate seeing another set of identical system files in the PC, especially this new set of system files was not created with its knowledge. Vista then proceeds to make both systems inoperable.
I once had Vista, XP and Linux in a cloned hard disk accidentally hooked with the source disk. The resulting 4 MS systems were sabotaged when I ran Vista. I wasn't sure of the culprit at that time.
It is true that the clone should always run "without" the presence of the source disk. There is no difficulty in cloning a Vista. Just don't let it see another copy of itself in any boot up.
I am in a foreign country and just bought a laptop with a 160Gb disk with nothing but Vista inside. I downloaded Slax and PCLinuxOS from the Internet, bought a couple of CD-RW discs and cloned the Vista into 3 other newly bought portable hard disks.
I am replying with Linux in a backup copy of Vista disk in a 250Gb laptop hard drive. The details of backing up Vista has been described in here (http://www.justlinux.com/forum/showthread.php?t=150678).
The Vista in my case has been cloned from an internal 2.5" 160Gb to an external 3.5" 500Gb which could not be verified its success because Vista does not support booting from external disk. However when the image of the 500Gb was transferred to a 2.5" 250Gb laptop disk which was placed into the laptop Vista booted up same as the original activated version. In the above link I explained the reason why I think Linux can successfully clone Vista from a bigger hard disk (500Gb) into a smaller hard disk(250Gb).
At the end of the day if something happens to a proprietary system a user is in a helpless situation if he/she does something outside what the system permits him/her to do. In Linux after even a small bit of the system is understood a user can do amazing things. I think using the "dd" command to clone Vista, which is one of the most difficult systems to clone, falls into this category.
fuseblower
11-29-2007, 05:13 AM
I have been trying for some time now to install any version of Linux on my Asus P5W DH Pro that uses a Dual Core Duo with ICH7R Intel chipset with sata 2 support and also my Nvidia 7950 GX2. The best distro so far has been opensuse 10.2 and none yet have supported the JMicron controller. Anyway I thought I was home and dry with opensuse 10.2 but use dd to copy from one sata to another and input/output errors pop up and process fails.
I have spent hours trying to resolve this problem but decided to go back to my first successful sata cloning which was to use an older PC that uses a VIA chipset and bingo. No probs. So I thought this might be of use given that I can mount these partitions that cannot be read by dd and so on...
Excelent forum.
Hope this is of interest.
saikee
11-29-2007, 11:08 AM
fuseblower,
Welcome to Justlinux.
On the difficulty of find a Linux to fit a modern mobo I seem to have the opposite effect of not able to find a distro that cannot be loaded into my PC, which is a Abit AW9D Max with Core Duo E6700. I run nothing but Sata II disk as internal and external eSata disks. The only thing I keep away is Raid.
dd operates at the hardware level between devices. Thus I can clone a raw disk directly from a new purchase without the need to mount it. A user does not need to mount any partition to use the dd command.
Mark_in_Hollywo
11-29-2007, 02:12 PM
Saikee's post/thread
How to migrate XP, Vista, Linux, BSD and Solaris to a bigger hard disk
is simply the best one I've read after hours of googling about what I'm trying to do. I didn't want to lose my configured, fully updated OS and apps, along with passwords, user id, cookies, etc. etc. etc.. I'm so happy that this didn't cause a re-install. Mostly what I found was info about users with a m$ product and linux. I don't like to use M$, so I have only Linux for the last 3 years.
A little background: I have a 20 gig drive, jumpered as slave and sitting on the cable as primary/slave.
As of November 28, 2007 I had a "bare metal" never-before-used 320 gig drive, jumpered cable select and sitting on the cable as primary/master.
Using G4L (formerly Ghost 4 Linux) I cloned the partitions and data from the slave to the master. It worked excellently.
mark@Lexington:~$ sudo fdisk -l
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 1 2040 16386268+ 83 Linux
/dev/sda2 2307 2434 1028160 5 Extended
/dev/sda3 * 2041 2306 2136645 83 Linux
/dev/sda4 2435 38913 293017567+ 83 Linux
/dev/sda5 2328 2434 859446 82 Linux swap / Solaris
/dev/sda6 2307 2327 168619+ 82 Linux swap / Solaris
Partition table entries are not in disk order
Disk /dev/sdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sdb1 1 2040 16386268+ 83 Linux
/dev/sdb2 2307 2434 1028160 5 Extended
/dev/sdb3 * 2041 2306 2136645 83 Linux
/dev/sdb5 2328 2434 859446 82 Linux swap / Solaris
/dev/sdb6 2307 2327 168619+ 82 Linux swap / Solaris
As you can see, with the exception of /dev/sda4 the two drives are identical. What I want to do is change ("move or re-allocate") /dev/sda4's space (approx. 297GiB) to /dev/sda1. The problem is that GParted LiveCD won't "resize/move" without creating another partition of about 4 gig. I would prefer not to create even more partitions, unnecessarily.
It was possible to do all the foregoing because my motherboard allows me to select which hard disk to "prioritize" for booting. At first, it was set to the drive sitting as primary/slave.
saikee
11-29-2007, 11:44 PM
Mark_in_Hollywo,
Welcome to Justlinux.
sda1 to sda4 are reeserved primaries. Thus after cloning the excess of 297Gb is at the end of sda5 of you previous 20Gb. It would appear to me that you might have created sda5 at the end of your 20Gb disk resulting the remaining space at the front end of the extended partition sda2 used up as sda6.
The partition table suggests that you had created the partitions in the order of sda1, sda2, sda5 and sda6. The partition order is a bit unusual but it is healthy.
What you want to achieve by putting the excess 297Gb into sda1 is achieveable and I would suggest the following steps.
(1) Fire up the Ubuntu in the 20Gb disk and invoke a Grub shell by command
sudo grub
(2) Verify the (hd0) is your sdb (by having no 3rd partition because Grub count from 0 and sdb4 would be the partition (3). That your sda is disk (hd1) by commands
geometry (hd0)
geometry (hd1)
(3) Assuming (hd0) is sdb you then hide the extended partition sda2 by command
hide (hd1,1)
Re-check the partition by command
geometry (hd1)which should show up only 4 partitions from 0 to 3 with the two logical partitions disappear. This is an intentended action so don't be alarmed. You then exit Grub by command "quit" to go back to Ubuntu.
(4) You then fire up Gparted inside the Ubuntu. Using it to delete sda4. You then bodily move sda2 to the extreme end of the 320Gb disk. Repeat the same for sda3 which should butt against sda2 at the end of the hard disk leaving a huge space of 297Gb between sda1 and sda3.
(5) You resize the end boundary of sda1 to absorb the desired space. You have now achieved you objective. So invoke a Grub shell. This time you unhide the sda2 by command
unhide (hd1,1)
(6) There is a 50% proability that Grub's action of step (3) and (5) are not accepted in Linux. This is to say Ubuntu still uses the original Bios setting and the partitions are unchanged after you exit Grub. In such case let us know and we can advise a different approach.
(7) Technically there is no need to restore Grub if sda1 is the "/" of Ubuntu. However you should remove the sdb temporily when booting sda. If you do have difficulty you can restore Grub when the PC boots to a Grub screen. Instead of slecting a system to boot you can press "c" to get a Grub prompt. You now have (hd0) as your sda and Grub can be restore by Grub commands
root (hd0,0)
setup (hd0)
If Grub reports no error your new Ubuntu should boot without a reboot using command
root (hd0)
chainloader +1
boot
------------------------------------------------------------------
There are more elegant ways to achieve what you want but the above is based on Gparted which is is technically sound and worthy of knowing the steps.
Mark_in_Hollywo
11-30-2007, 12:36 PM
From Saikee's response to my question:
"(3) Assuming (hd0) is sdb you then hide the extended partition sda2 by command"
It was at the instruction above that I became confused and stopped. In my particular case hd0 is sda.
grub> geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 3, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type unknown, partition type 0x82
grub> geometry (hd1)
drive 0x81: C/H/S = 2434/255/63, The number of sectors = 39102336, /dev/sdb
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type unknown, partition type 0x82
I think you want me to "hide" the partitions on the 320 gig, not the 20 gig. Please remember, my BIOS/Motherboard allows me to set the PRIORITY of the boot disk. I can make sda the equivalent of slave on the cable. I can make sdb the equivalent of master on the cable.
Having convinced myself, after, triple reading your first response to me, I am going back into the grub on the 320 gig and "hiding" the partitions. I will let all reading this know what happens after that. But it is much harder to follow directions, when "zeros" become "ones" and "a" becomes "b".
After following the grub command hide (hd1,1) grub returned:
grub> geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type unknown, partition type 0x82
grub> geometry (hd1)
drive 0x81: C/H/S = 2434/255/63, The number of sectors = 39102336, /dev/sdb
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type unknown, partition type 0x15
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
So I guess I should have made the command: grub hide (hd0,1).
Inside GParted shows a confusing picture. (see attached screenshot)
In the screenshot: /dev/sda2 (an active partition) shows 280Gib allocated and an unallocated 279Gib at the end. This can't be the desired results. Additionally, I cannot move the sda2 or sda3 at all. I tried reallocating the unused space, but got too confused.
I went back to grub and did grub hide (hd0,1) instead of hd1,1. GParted then showed only 2 partitions and NO swap. I'm really lost and am wondering if you could talk a little about the "more elegant solutions". I'm finding myself attracted to simpler methods of fixing this.
By the way: you mention the "oddness" of the partitions being in (I think) numeric order. The original partitions on the 20 gig were created during my using Synpatic to upgrade the Feisty (v. 7.04) to Gutsy (v. 7.10). Whatever did the upgrade did it without my doing any partitioning work. What I had never seen before was a 2.0 gig partition that seemed to have no reason to be there.
saikee
12-03-2007, 06:27 AM
Mark_in_Hollywo,
OK. I have finished my Far East holiday and can answer your post.
Your extended partition behaves slightly different to my prediction. This is possibly due to the way you created it as the extended partition can have one partition type. By hiding it the partition type just has "1" added to the type number and this should show up in the "fdisk -l" command in root console.
Can you list the "fdisk -l" output (in root console) before and after hiding sda1?
I have moved an extended partition "bodily" this way before. It should be looked upon by Gaparted as just another primary partition of unknown filing type once the extended partition is hidden. I remember doing this for upgrading a 320Gb disk to a 500Gb disk and increase the Vista partition this way. After the extended partition has been moved I unhid it and had to restore the boot loader for every distro in the 59 logical partitions inside (a Pata disk was permitted to have 63 partitions in Kernel older than 2.6.20). This is because once the extended partition has been moved "bodily" the hard disk address of each boot loader will have been changed. In your case the boot loader is in sda1 so you should have no need to restore the boot loader.
Thus I am surprised to see the hidden partition didn't show up in Gparted. Your output suggests that you may have "deleted" the two ligical partitions if you ended up with more hard disk space later.
In this thread (http://www.justlinux.com/forum/showthread.php?t=149956) where I show how one can get 44 partitions out of a hard disk (post kernel 2.6.20) you can see that I have the extended partition in all sda1 to sda4 as type 5. At any time I unhide one so that the other 3 are typr "15" which is not recognised by Linux (hence the trick to get 4x11 partitions).
Mark_in_Hollywo
12-03-2007, 01:17 PM
Your extended partition behaves slightly different to my prediction. This is possibly due to the way you created it as the extended partition can have one partition type. By hiding it the partition type just has "1" added to the type number and this should show up in the "fdisk -l" command in root console.
Can you list the "fdisk -l" output (in root console) before and after hiding sda1?
I tried to follow your instructions in your post to me that showed how to make grub hide / unhide as best I could. The results are posted below.
grub could not/would not allow a parameter as sda1, per your post, quoted above. I have pasted what I could get grub to do.
grub> hide (sda1)
Error 23: Error while parsing number
grub> hide (sda1,1)
Error 23: Error while parsing number
Then I looked at the geometry as a double check to find sda or sda1
grub> geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type unknown, partition type 0x82
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
grub> geometry (hd1)
drive 0x81: C/H/S = 2434/255/63, The number of sectors = 39102336, /dev/sdb
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 2, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type unknown, partition type 0x82
========================================
WITH (hd0,1) HIDDEN, the output is:
NEXT, the above mistake made me think you meant (hd0) so I:
grub> hide (hd0,1)
and the output of fdisk -l is:
mark@Lexington:~$ sudo fdisk -l
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 1 1785 14337981 83 Linux
/dev/sda2 1786 2040 2048287+ 92 Unknown
/dev/sda3 * 2041 2306 2136645 83 Linux
Disk /dev/sdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sdb1 1 2040 16386268+ 83 Linux
/dev/sdb2 2307 2434 1028160 5 Extended
/dev/sdb3 * 2041 2306 2136645 83 Linux
/dev/sdb5 2328 2434 859446 82 Linux swap / Solaris
/dev/sdb6 2307 2327 168619+ 82 Linux swap / Solaris
=====================
and then I
grub> unhide (hd0,1)
with state as NOT hidden the output of fdisk -l, below:
mark@Lexington:~$ sudo fdisk -l
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 1 1785 14337981 83 Linux
/dev/sda2 1786 2040 2048287+ 82 Linux swap / Solaris
/dev/sda3 * 2041 2306 2136645 83 Linux
Disk /dev/sdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sdb1 1 2040 16386268+ 83 Linux
/dev/sdb2 2307 2434 1028160 5 Extended
/dev/sdb3 * 2041 2306 2136645 83 Linux
/dev/sdb5 2328 2434 859446 82 Linux swap / Solaris
/dev/sdb6 2307 2327 168619+ 82 Linux swap / Solaris
Is there a way to make grub hide or unhide a device called: sda? or sda1? Is that what you want?
saikee
12-04-2007, 04:38 AM
It appears that your two previous swap logical partitions have gone into one. This may not be a fault as a swap is just a scratch area for temporary storage.
Youe have hide the sda2 successfully already.
Your sda2 is now a primary partition of type 82 which is recognised by the kernel. By hiding it the type number changed to 92 (the "1" is added to the second digit as expected) and not recognised by the Linux kernel.
The matter is therefore simplified now. You don't have to hide sda2 any more. Just use Gparted to shift the partitions around to chnage their size to your wish.
You PC should boot OK if you amend the Linux's fatab in sda to mount only sda2 (instead of sda5 and sda6 or sda5 and sda6).
I would now edit fstab to get the Linux in sda working first before changing its partitions sizes. If you have a problem then post the /etc/fstab and /boot/grub/menu.lst (/boot/grub/device.map also useful) of the Linux in sda here.
Mark_in_Hollywo
12-04-2007, 12:42 PM
It appears that your two previous swap logical partitions have gone into one. This may not be a fault as a swap is just a scratch area for temporary storage.
I think I deleted all partitions except the one labeled with the word: boot and the one above it which as labeled: sda1
Youe have hide the sda2 successfully already.
I'm not so sure it is hidden. It is more likely deleted.
Your sda2 is now a primary partition of type 82 which is recognised by the kernel. By hiding it the type number changed to 92 (the "1" is added to the second digit as expected) and not recognised by the Linux kernel.
The matter is therefore simplified now. You don't have to hide sda2 any more. Just use Gparted to shift the partitions around to chnage their size to your wish.
You PC should boot OK if you amend the Linux's fatab in sda to mount only sda2 (instead of sda5 and sda6 or sda5 and sda6).
Sorry, I think you mean fstab, not fatab. Anyway, as you can see from the fstab output below, there is no sda6.
I would now edit fstab to get the Linux in sda working first before changing its partitions sizes. If you have a problem then post the /etc/fstab and /boot/grub/menu.lst (/boot/grub/device.map also useful) of the Linux in sda here.
I'm too confused to do anything. The last time I edited my menu.lst I lost the entire drive. And had to reformat/reinstall. I'm going to wait for your advice/instructions before I continue.
=====================
output of /boot/grub/menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=7a70ca0f-767b-4efb-8d00-7b5c800098d4 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
title Ubuntu 7.10, kernel 2.6.20-16-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=7a70ca0f-767b-4efb-8d00-7b5c800098d4 ro single
initrd /boot/initrd.img-2.6.20-16-generic
title Ubuntu 7.10, memtest86+
root (hd0,0)
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
==============================
output of boot/grub/device.map
(hd0) /dev/sda
(hd1) /dev/sdb
saikee
12-04-2007, 01:40 PM
OK I shall take you by the hand.
When you hide (hd0,1) your "fdisk -l" has this output
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 1 1785 14337981 83 Linux
/dev/sda2 1786 2040 2048287+ 92 Unknown
/dev/sda3 * 2041 2306 2136645 83 Linux
When you unhide sda2 (or (hd0,1) to Grub) the output is
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 1 1785 14337981 83 Linux
/dev/sda2 1786 2040 2048287+ 82 Linux swap / Solaris
/dev/sda3 * 2041 2306 2136645 83 Linux
This is exactly what it should be. In normal mode sda2 is a swap with Type 82. Hiding it adds "1" to its first digit making it Type 92. Type 92 is unknown to the kernel so it reports it as unknown.
The hiding and unhiding with sda2 is no longer necessary because it is not an extended partition containing more than one logical partition inside.
How do we know it is a primary? By the device name sda2. Because all logical starts at the 5th position while sda1 to sda4 are reserved primaries.
How do we know sda2 is no longer an extended partition? By the partition type 82. An extended partition will have a different partition type.
So your sda disk is now perfect and all you need is to fire it up. So let's look at the 3 files that affects its booting.
(1) /boot/grub/menu.lst
This looks alright to me as it boots only the (hd0,0) or sda1. What you can improve the situation is to amend it with the red bits I added here
timeout 300
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
I elongate the timeout statement to 300 seconds to allow you plenty time to decide on which system to boot. The "#" I added in front of the hiddenmenu statement will cause the full menu to be displayed. The "#" is use to disable the line, as Grub does not execute any line started with a "#".
The changes are optional but can help you to boot the system manually should you require to do it.
Your booting choices are all for one Linux using different kernels and different modes. Normally the default is the first one you should boot.
(2) /boot/grub/device.map
This is correct too as the (hd0) to Grub is device sda in Linux. No action is needed here.
(3) /etc/fstab
This needs updating because you have no sda5 and so the line for swap has to be changed as follow (marked in red)
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=7a70ca0f-767b-4efb-8d00-7b5c800098d4 / ext3 defaults,errors=remount-ro 0 1
# /dev/sda5
/dev/sda2 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/scd1 /media/cdrom1 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
After carry out the changes and save the files I suggest you restore the Grub as follow
(a) Boot it up with a Live CD or continue if you are using the Live CD
(b) Invoke a Grub prompt and restore Grub
sudo grub
root (hd0,0)
setup (hd0)
quit
If no error is reported reboot the PC, remove the CD and the Linux in sda will appear.
If you have any trouble in booting the partition is always safe and there is no need to format or destry it. You can always rescue any Linux by just a Live CD! Don't forget it.
I have not mentioned the Linux in sdb because your information suggests that it should not affect the execution of sda disk.
Lastly do not get confused. If you do not understand the commands just ask why!
Mark_in_Hollywo
12-04-2007, 04:04 PM
FIRST: Thank you for a "hand".
The instructions worked as you said they would.
mark@Lexington:~$ sudo fdisk -l
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 1 1785 14337981 83 Linux
/dev/sda2 1786 2040 2048287+ 82 Linux swap / Solaris
/dev/sda3 * 2041 2306 2136645 83 Linux
Now - What is next? Do I allocate the unused 280 gig to sda3? or sda1? I know the partitioning must be done contiguously, but I haven't the foggiest as to how to go about that. This is how I lost/removed sda-s 5 & 6 a few days ago. It the 280 gig goes to sda1, where does sda2 and 3 go in the meantime?
Thank you again.
saikee
12-04-2007, 05:59 PM
The size of a Linux partition depends on how you use it.
If you download a lot of Internet data then your /home directory will be huge. However if you move the data regularly to a neutral partition that can be mounted in different OSes then your Linux partition can be a lot smaller.
I would say a 10Gb partition is big enough to hold 99% of the Linux which is about 2.5 to 3.5Gb large when first installed. Some Linux users, me included, like to keep useful data in a personal partition that will be safe from the failure of a operating system. This makes backing up data smaller and easier because I don't need to back up the operating system.
In your case I would recommend varying the sda1 to test Gparted ability to resize the partition. Any thing larger than 20Gb for a Linux is hard to maintain as you will not know which data is yours and which are system-related.
There is no standard usage of a hard disk. You should just try different combinations and find one that has the best appeal to you, while in the process learn the various tasks you can do in Linux.
You need to resize sda1 so that you can be sure yourself that you are indeed using the Linux from the disk sda and not from disk sdb.
Mark_in_Hollywo
12-06-2007, 05:11 PM
I got very lost somehow. I removed the # from the fstab file, but then on shutdown, the OS reported failures which flashed by too fast for me to read, but they did involve sda5.
Next, I'm no closer to understanding why I can't or shouldn't use the remaining 280gig for /home? I have no other OSs that should "share" and believe me, the trouble with ONE os is enough. I'm a food writer, and get hurt easily just touching a keyboard (just kidding).
Lastly, please look at the attached screenshots. How on Earth is it Possible that a disk can be "unmounted" and operating at the same time?
saikee
12-06-2007, 05:35 PM
This time you only got yourself to blame by removing the # indiscriminately in fstab, as nobody advised you to do it. I have been careful in even highlighting the changes in red for you. If you self-inflict damages to your system then it will be very difficult for others to rescue your system.
What you should do is to revert to the working system you have before.
Your system should have sda1, sda2 and sda3. If you want to enlarge sda1 you need to "bodily" shift sda2 and sda3 to the end of the disk so that sda1 boundary can be resized.
On the unmounting problem I believe it is just your understanding of an extended partition which is just a border for holding a set of logical partitions. Since you have no logical partition inside so there is nothing mountable. Thus Gparted is displaying everything correctly.
You can gain a better understanding if you use the terminal program "cfdisk" to do partition. With cfdisk there is "no" facility to create an extended partition. You only create either a primary or a logical partition. When the first logical partition is created the extended partition is automatically generated, using the next available unused primary partition position between sda1 to sda4.
Mark_in_Hollywo
12-06-2007, 06:59 PM
"This time you only got yourself to blame by removing the # indiscriminately in fstab, as nobody advised you to do it . . .
What you should do is to revert to the working system you have before."
Here is the problem, the entire 320gig drive is working without problem, it simply isn't mounted. Every partition: primary, logical, extended.
Your system should have sda1, sda2 and sda3. If you want to enlarge sda1 you need to "bodily" shift sda2 and sda3 to the end of the disk so that sda1 boundary can be resized.
My disk, as currently partitioned has the three partitions you describe. From the screenshot you can see there is an additional huge sda4.
On the unmounting problem I believe it is just your understanding of an extended partition which is just a border for holding a set of logical partitions. Since you have no logical partition inside so there is nothing mountable. Thus Gparted is displaying everything correctly.
I don't fully understand what you mean, the screenshot, named: /dev/sda3.png, shows that the boot directory isn't mounted. I do say that the disk drive seems to be working flawlessly. Ubuntu Gutsy Gibbon (v 7.10) was reporting shutdown errors (fail) when the # was removed
You can gain a better understanding if you use the terminal program "cfdisk" to do partition. With cfdisk there is "no" facility to create an extended partition. You only create either a primary or a logical partition. When the first logical partition is created the extended partition is automatically generated, using the next available unused primary partition position between sda1 to sda4.
If I had time to become as skilled as you, sir, I would give up my day job and become a Linux programmer. As it stands, I had hoped to take the information from these posts and write a brief tutorial on how to make this painless, but I no longer believe that is possible. The painless part, I mean. I will endeavor to change the partitions as you suggest, moving them "up" one at a time. While we all know that nothing is foolproof, it is hard to reconcile the dearth of information about Linux partitioning. If I had Linux and M$, then the job would have been painless. Nuts. Thanks for your time.
saikee
12-06-2007, 08:16 PM
According to the fstab your Ubuntu uses only sda1 as the root filing system.
It uses sda2 as the swap.
Your sda3 has never been used by Ubuntu. It could be another partition you might have created before, possible for another Linux which you can boot too if you are prepared to amend its fstab to take account of the alteration of the swap partition.
You are now using Ubuntu on sda1 partition that is about 14Gb.
You have correctly cloned the distro across and condensed the two previous sda5 and sda6 swap logical partition into one swap primary partition sda2.
On the mounting of the partition you can always mount it manually in terminal or automatically by amended the fstab. Some distros mount every partition automatically, others only mount the ones detected during installation and some leave the users to decide what they want.
I notice you have created sda4 as the extended partition but as it was not part of the Ubuntu Linux it can only be mounted as an additional feature like a data-only partition. In any case as I have said before your extended partition cannot store anything. It is just a frame or a border! The storage come from the logical partitions. You are now at liberty to create sda5 to sda15, a total of 11 logical partitions in future as long as there is still empty hard disk space within the 280Gb of sda4.
Your previous post tells us your main intention is to enlarge sda1. Thus creating sda4 is an diversion which we do not understand your motive because that eats up every available empty hard disk space making your original task impossible to accomplish.
I am not a programmer myself and my work is totally unrelated to IT. I do not have any advantage over you except may be starting a bit earlier than you.
I believe you have succeeded in migrating the operating systems but failed in resizing the partitions. The failure is due to the unexpected creation of sda4.
If you want to resize sda1 as originally intended then you need to delete sda4.
I am sorry to see that you are frustrated by the terminal program cfdisk which is what a user should have used for creating partitions due to its simplicity. Gparted creates and formats a partition simultaneously and so it is much more difficult to understand, control and reverse.
On partitioning of a hard disk I would say one can understand the process a lot better in Linux than any MS system, especially with the terminal commands. The process is identical to MS Windows, Solaris and BSD systems so you do not waste time and energy to learn it. Believe me it is not a pain to understand something you have overlooked in the past. If you multi-boot and are therefore heavily dependent on the partition integrity you would not go very far without the basic knowledge of how the partitions work. Yet partitioning of an entire hard disk is just writing out a maximum of 64 bytes in the MBR and nothing else. You will laugh at yourself one day on this "pain" when you have mastered the concept of the partition table.
You may have a high opinion of M$ partitioning software but it can only do a fraction of what Linux can do. For a start Linux supports 100+ partition types. You can use Linux to prepare partitions for every operating systems in the PC. Try it with a M$ system and you will know its limitations.
knarf_foo
01-21-2008, 04:07 AM
saikee,
First of all, thank you for your dedication and the help you are to all those newbies ( like myself ). I haven't yet used any of your how-to's yet but, I'm sure one day I will.
I have noticed that some of your how-to's are very explicit and hence lengthy. I was wondering why you have not made them into pdf documents!!!
It's just a suggestion but i suppose you have your own reasons why you've not done so.
Thanks again.
saikee
01-29-2008, 05:55 AM
knarf_foo,
The existing format in the howto of the Justlinux allows me to add, amend and update information. Thus if a howto is useful and popular I would try to maintain it, making it up to date.
I have thought of making some of the information into help files for submission to the Justlinux but changes in Linux have been so rapid that I find continuous updates can make the information more useful.
I tend to put in the technical information, sometimes with explanation, so that readers can alert me if there is something inaccurate.
Can't get everything right myself but I am trying to be factual. The joy of Linux is once you know its inner working you can play tunes with it. To me it is equally important to understand it as well as using it.
rjhythloday
02-20-2008, 07:47 AM
MkIII_Supra,
I never need to do cloning with Linux partitions myself.
The mod here has taught me using tar. Here is what I would go about getting a 120Gb /home into a 500Gb disk
(1) Boot up the existing Linux
(2) I am assuming the 500Gb disk starts as a raw disk and has a name , say sde. I would use cfdisk (or fdisk if you are using a Red Hat) to create a partition sde1 for the whole disk or a size of my choice. It should automatically Type 83 native for Linux. A reboot is unnecessary but doing one is a good practice if you can afford the time.
(3) I would then format the sde1 to the filing system of my choice and then manually mount it by terminal command in root
mkdir /mnt/sde1
mount /dev/sde1 /mnt/sde1
(4) The tar instruction I learned from the mod is
cd /home
tar cf - . | ( cd /mnt/sde1; tar xf -)
The tar command will copy the entire content of the current partition (that I have changed directory to), inculding all settings of ownership to /mnt/sde1.
(5) I would now check the content of /mnt/sde1 and satisfy myself everything is there. Then I would edit /etc/fstab to mount the /home to sde1
On a reboot I should have my home in the 500Gb disk environment. After a short period of usage and convinced the /home is working perfectly I shall use the 120Gb disk for another purpose.
The cloning procedure of Post #1 can be used too but you have to resize the partition after the cloning operation. It has the following disadvantges
(a) You clone every bit of the the entire 120Gb including unused and empty spaces. Tar only moves files and empty spaces are left behind so it is much faster.
(b) You have to resize the partition from 120Gb to 500Gb. Tar transfer the files from 120Gb to 500Gb naturally.
The cloning is only necessary if the OS has a protection mechanism or a rigid arrangement for retrieving its system files. Linux partitions do not fall into that category and so the normal Linux commands are good enough to move Linux systems from partition to partition and from hard disk to hard disk.
I include Linux in my title mainly because I clone disks with many operating systems inside.
Personally I rarely resize a partition for Linux. I enjoy the teaching by the mod and it gives a kick every time I use it. To me that is what Linux is all about ---> a rich set of Command Line Interface (CLI) that is superior to other OSs.
I use tar, exactly the same instructions as above except cd to /mnt/sdax instead to /home, to move the entire Linux which I always installed in a single partition. When needed I mount an additional data partition.
the person you were replying to was leaving boot on the existing hdd, would this work to migrate everything? I posted here (http://forums.pcper.com/showthread.php?p=4219343#post4219343) about wanting to use my faster hdd, If possible I'd like to avoid reconfiguring everything and possible. I'd be moving my os which is about 10gb right now on a 80gb sata to a 750gb and using the 80 for a back up of some sort.
saikee
02-20-2008, 01:54 PM
rjhythloday,
Welcome to Justlinux.
The easiest is to follow Post #1 of this thread.
My reply to MKIII_Supra also work but is slightly more involved. The basic difference is
dd copies binary bits of "1" and "0" of the hard disk. You therefore clone the 80Gb hdd partition table onto the new 750Gb disk. It will boot exactly as the 80Gb because the boot sector is also duplicated. You get an exact clone. The remainder of the 750Gb become unallocated hard disk space. You can create additional partition with the unallocated space or run "gparted" or "Parted Magic" live CD to resize the existing partitions to absorb the unallocated space. The choice is youre.
If you use file copying command, like tar as I recommended to MKIII_Supra, only the files are copied and not the partition table or the boot sector. Therefore you need to restore the boot loader which is a simple matter. This solution does allow you to choose a destination partition of any size without the need of resizing.
All the information is contained in Post #1 which is the "Howto". The other posts, like the present one are queries and answers.
Please feel free to raise questions. You will find a lot of willing helpers here.
I normally offer too much information as I try to explain the steps. The actual cloning operation is dead simple.
rjhythloday
02-21-2008, 01:07 AM
Thanks for the reply, I'll give the clone a shot. I did manage to restore my xorg.conf today from cl. I put my agp back in and was hoping it would just auto detect. More reading to do!
drooid
06-01-2008, 09:42 AM
Hi Saikee.
Fantastic information, friend. Its well appreciated that you go the extra, clear step in explaining the processes. It can be daunting to one-time cloners like myself.
I have a question, i hope you or anyone here can help, as i will be cloning my HD as soon as possible.
My laptop HD died recently and i had a new one installed under warranty. At first, great. Only, i use the computer [toshiba laptop] for audio purposes, and the repair shop installed a 4,200rpm drive [SATA / 2.5" 200g], whereas the old [dead] one was a 5,200rpm [SATA / 2.5" 200g]. Thats now unacceptable speed and performance wise so i've decided to buy a W.D. 7,200rpm [SATA / 2.5" 200g+] drive and Migrate/Clone my VISTA OS and all files.
But Toshiba's have a 'HIDDEN VISTA INSTALL PARTITION' on their factory drives, as the units dont come shipped with a Vista DVD.
Will the Linux LiveCD DD function recognise this hidden partition? I'm assuming so thus far, as you have stated that the process is simply cloning '1's and '0's, but need to be sure.
Alongside this, I am planning to do the transfer within my SATA Desktop PC. The reason for this is my laptop can currently only support a single drive. I will be unplugging ALL of my desktops SATA drives and plugging in my existing VISTA 2.5" drive and the to-be-cloned 2.5" drive, then booting into Linux. After the clone i will shut down the desktop, install the newly cloned drive into the laptop and hope i dont have to re-certify vista.
This seem like a perfect plan?
Also, do you still reccomend either of the two bootable LiveCD's from the first post in this thread as the best ones for uneducated Linux users? and does anyone have a link?
Thanks in advance peoples!
saikee
06-01-2008, 12:18 PM
drooid,
Welcome to Justlinux!
I believe the hidden Vista partition will work in the clone.
In your case, you are cloning different makes of hard disks I strongly advise you to check and ensure the new target disk is at lease as large as the existing source disk. This means the new disk must have the number of sectors at least the same or more than the source disk, otherwise your new disk will not work because the partition table will indicate a bigger number sectors than actually available. No operating system would touch such disk as no one would know what to do with it while guaranteeing the data security at the same time.
Using a desktop to do the cloning, while removing all the existing hard disks, is a smart move especially if you are not comfortable with the device names from the Linux side. I have used 3.5" to 2.5" adaptor to carry out such cloning before but that was for Pata disks. I am not aware the same kind of adaptor is sold for Sata disks though.
What I have discovered recently is the use of eSata on a laptop. One can buy such adaptor in the PCMCIA slot or the newer narrorwer card bus slot. There are 2.5" hard disk enclosures sold with both USB and eSata connectors. The eSata is about 2 to 3 times faster than USB connection and well worth having. It allows a faster transfer on your 2.5" disk whenever it is used externelly. This way you don't have to use a desktop PC at all.
I have done this myself recently cloning a new HP laptop, changing its 150Gb hard disk to 250Gb disk within 24 hours after the purchase while on a holiday.
If you clone Vista, which has its own resizer facility internally, then any Linux Live CD will provide you with the Bash command dd. While on holiday I just download Slax (http://www.slax.org/), burn it into a CD and use it to do the cloning.
Lastly I strongly recommend check the disk geometry by the Linux terminal command
fdisk -l
IN it you should know exactly the device names of every partition and hard disk. As long as you make sure the output file (the "of=/dev/sdx" in the dd command) is correctly pointed to your target disk you should have a successful migration.
drooid
06-01-2008, 06:08 PM
Thanks for the quick reply.
Okay, so today i'm aiming at a 250gig WD drive if i can find one thats 7200rpm. that'll give me 50 gig extra room, and a truckload of faster data i/o :)
I'm happy to do the transfer on my desktop, and by pulling out my other drives, nothing can go wrong with the precious data. But i'll definately look into eSata.
Thanks so much, Will be doing the process today or tomorrow and I'll be sure to update the result, for other NooB's!
[edit first post, i meant to say 5,400rpm, not 5,200rpm :S]
slafochmed
06-07-2008, 04:49 PM
Hi saikee, thanks for the great threads, it's exactly what I have been looking for, for some hours now. :)
I would like to try the imaging with two systems and have some questions.
I am just dreaming about a magic Linux Live CD that someone might know. :)
I wished:
--> it could boot up a live system in a small 56 MB Ram (the smallest of my systems)
--> has ndiswrapper ready
--> can mount a ntfs harddisk (ntfs-3g?)
My ultimate wish is to use your procedure to image systems via external usb harddisk or wifi usb stick, to a file, and then restore the systems.
Is there something like that or is that a dream of a foolish linux-noob. :D
slafochmed
06-07-2008, 06:22 PM
YES, there is!
I downloaded Knoppix LiveCD 5.1.1
I started with boot option
knoppix 2
to get into command line.
I found the output out of the borders of the display, so I adjusted:
stty rows 37
I could then see what happend. :)
And! :) :) :)
ndiswrapper
ntfs-3g
are both there!
fdisk -l
I found my source disk being hda and my target disk being sda1
mkdir /mnt/export
ntfs-3g /dev/sda1 /mnt/export
I have mounted a usb ntfs harddisk and I am now
dd if=/dev/hda of=/mnt/export/export.img bs=32256
Very curious! :)
hiwa
08-07-2008, 07:28 PM
I want to move the entire current system to a new hard disk because I get
--------------------- Smartd Begin ------------------------
Currently unreadable (pending) sectors detected:
/dev/hda - 28 Time(s)
3 unreadable sectors detected
for months.
The question is: can I do dd for the above slightly damaged disk without getting error abort? If the answer is no, then what could be the best method of the move?
Thanks in advance.
saikee
08-07-2008, 08:41 PM
hiwa,
You can try dd with the "noerror" option.
It is defined in "man dd" as
noerror
continue after read errors
Failing that you can also try to download "ddrescue" which has good reports on salvaging bad disks but I haven't had a disk bad enough (and without backup) to use it yet.
hiwa
08-09-2008, 02:04 AM
Thanks saikee.
dd if=/dev/hda of=/dev/hdb bs=32256 conv=noerror
did work perfect. It took thirty-three minutes for 40 GB hda disk to dump. It was such a piece of cake that it felt anticlimax...
side effect:
Old Maxtor 40 GB ... Noisy and slow
New Seagate 160 GB ... Silent and fast
Thanks again. Yours is a very good article.
saikee
08-09-2008, 08:40 AM
Glad to hear you got it sorted.
Thanks for confirming that the procedure is easy as I have claimed.
hiwa
08-09-2008, 06:32 PM
A funny aftermath
We see on the brand-new disk:
--------------------- Smartd Begin ------------------------
Currently unreadable (pending) sectors detected:
/dev/hda - 12 Time(s)
3 unreadable sectors detected
It has 'inherited' the info for the bad sectors from the old disk! Could we fix this without reformatting?
saikee
08-09-2008, 07:41 PM
A successful cloning of a hard disk is you get exactly a mirror image of the original.
The bad sectors in the original can be physically corrupted areas. They cannot be read and so cannot be written on the new disk. Thus the physical damage is not transferred. All you have is the partition has a few minor holes in some of the files.
The easiest is to delete the damaged files. No need to reformat the disk unless the OS depends on the damaged files. In such a case your system should not boot.
hiwa
08-09-2008, 09:41 PM
> The easiest is to delete the damaged files
The problem is how to find them.
sawsedge
09-02-2008, 10:55 AM
Hi all. I am trying to clone an XP install following the instructions here. I'm booting using a recent parted magic live CD.
I must be missing something. I keep getting "missing operating system".
I have XP on a 20 gig drive. I'm trying to use DD to clone XP to a 40 gig drive (entire drive).
BIOS picks up the drives fine. fdisk, cfdisk, parted all ID the drives.
I'm using:
dd if=/dev/sda of=/dev/sdb bs=32256
40 gig is using cable select, 20 gig disconnected when I try to boot. Every time, I see "missing operating system". I tried using fixmbr from the xp sp2 cd with no luck.
Any suggestions?
saikee
09-02-2008, 04:23 PM
sawsedge,
Your error message is consistent with the Bios failed to find an operating system in your hard disk.
When you use the Parted Magic CD, click the terminal mode and post here the output from the command
fdisk -l
On completion of the cloning there should be a message of how many record in and out.
Since you are cloning 20Gb and each record is 32256 byte long so you should see about 620039 records in and out reported. Did you get that report? The in and out records are the number of times the hard disks being read and written. The disk is correctly cloned if the number of records in is equal to the number of record out.
Remember there is nothing shown in the cloning process except the flickering of the hard disk LED. Allow 30-40Mb/s transfer rate for both internal disks. If one or two of them are USB hard disks the transfer rate can drop below 10Mb/s and so it needs about an hour time to clone an internal 20Gb disk into a USB external hard drive.
sawsedge
09-02-2008, 06:05 PM
What you describe for the dd command is about what I saw. I don't recall the exact number of records... the dd command took about 20 minutes or so.
Here is the info: (40 gig not attached at the moment, kind of harried right now, will have to do it later)
root@PartedMagic:~# fdisk -l
Disk /dev/sda: 20.4 GB, 20490559488 bytes
16 heads, 63 sectors/track, 39703 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x384372b4
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39702 20009776+ c W95 FAT32 (LBA)
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000a1dc7
Device Boot Start End Blocks Id System
/dev/sdb1 1 1 8001 83 Linux
/dev/sdb2 2 523 4192965 82 Linux swap / Solaris
/dev/sdb3 524 5622 40957717+ 83 Linux
/dev/sdb4 5623 60801 443225317+ 5 Extended
/dev/sdb5 5623 60801 443225286 b W95 FAT32
root@PartedMagic:~#
sawsedge
09-03-2008, 06:40 AM
Hi Saikee,
Thanks for your time, I appreciate this. I tried installing Xubuntu on my 40gig drive and it installed without issues, boots and runs. Here is the drive info you asked for:
root@PartedMagic:~# fdisk -l
Disk /dev/sda: 20.4 GB, 20490559488 bytes
16 heads, 63 sectors/track, 39703 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x384372b4
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39702 20009776+ c W95 FAT32 (LBA)
Disk /dev/sdb: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x384372b4
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 243 1951866 83 Linux
/dev/sdb2 244 729 3903795 82 Linux swap / Solaris
/dev/sdb3 730 4863 33206355 83 Linux
root@PartedMagic:~#
saikee
09-03-2008, 09:07 AM
If you have installed Xubuntu then it has to be in sdb disk as sda has only one partition and it is a MS Windows with the FAT32 filing system.
If your sda is the first bootable disk (hd0) then your Windows will boot if these commands are in /boot/grub/menu.lst
title WIndows
root (hd0,0)
chainloader +1
If the above fails post the content of Xubuntu's /boot/grub/menu.lst here.
sawsedge
09-03-2008, 10:10 AM
Hi Saikee,
I probably haven't been very clear, sorry. I'm usually pretty good with hardware but this has me stumped. I've never tried to clone a Windows OS before this though.
My goal is to clone the Win XP installation from the 20g drive to the 40g drive. The 20g is out of space. The 20g drive is my original XP install drive and it works fine aside from the space issues.
After running DD on the 40g drive, I was able to access the files on the cloned 40g drive via parted magic... it just won't boot.
I've tried several free cloning tools. Your method sounds the most promising but I got the "missing operating system" as I mentioned before. After trying about 6 programs (none of which worked - all had similar issues), I began to wonder if the 40g drive had errors, even though I didn't detect any issues in formatting, partitioning, etc. To test the bad hardware theory, I installed Xubuntu on the 40g and it boots and runs fine. I assume the 40g drive is ok. When I installed Xubuntu, I had only the 40g drive connected. The 20g XP drive contains only the XP loader.
The 40g drive is a scratch drive so to speak, at least until I get a good working copy of XP on it. I can blow it away with a new format at any time.
It seems like the BIOS detects the drives just fine. I also have a 250g and 500g for data (and a new IDE controller coming soon so I can use them all at once). My BIOS automatically detects each drive.
I've already spent more time on this than just reinstalling the OS and calling MS to reactivate it... at this point I'm just trying to learn what, how and why this is a problem. I only have two things that cause me to keep Windows installed... photoshop and some games. As soon as GIMP supports 16-bits per color channel half my reason is done... maybe Wine will do for the rest.
Again, thanks for your help and suggestions.
saikee
09-03-2008, 07:04 PM
OK I have re-read your partition table. There might be a problem with your disk geometry.
Your 20Gb hard disk is an old one with
Disk /dev/sda: 20.4 GB, 20490559488 bytes
16 heads, 63 sectors/track, 39703 cylinders
where as the 40Gb disk has the LBA mode with 255 head and 63 sectors
Disk /dev/sdb: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders
There may be some bios problems with the non-LBA older hard disk geometry imposing on the new hard disk which since has been standardised with LBA mode.
Nearly all my cloning work was with LBA hard disks with the standardised 255 heads and 63 sectors and so I didn't experience any problem.
Couldn't offer a solution here but if you are going to put Xp in a hard disk try it on a hard disk with LBA mode.
sawsedge
09-03-2008, 09:22 PM
Saikee,
Interesting. I hadn't thought of that, and I doubt I would have. I figured the matching sectors/track was good enough. It explains much.
Thank you for your help!
I'm planning a hardware upgrade of the board, cpu, etc soon (6 year old system, I guess the 20g drive is even older) so I'll just wait for all of that and reinstall from scratch.
thanks again,
Sawsedge
saikee
09-04-2008, 01:44 PM
sawsedge,
I did manage to clone systems with different geometries but had not investigated the process deep enough to make any useful contribution. The problem is of course hard disk specific. I also remember the cloned disks did have a stability problem of some sort.
All in all I would move with time and forget the old disks. AFAIK all hard disks sold nowadays are standardised in LBA mode with 255 heads and 63 sectors.
sawsedge
09-05-2008, 06:37 AM
Yes I will do that as soon as I get the new board/cpu etc.
I had noticed on boot that the 20g is always reported as CHS, the rest of the drives as LBA. Thinking back on it, I believe I got that drive when I had a Celeron 366, so it is quite old.
Thanks again.
drsatch
10-15-2008, 12:38 PM
Little background...I had a disk that was showing signs of failing in my laptop. I purchased a new hard drive and usb enclosure to do a clone. Both gparted and parted magic would not even see the fact that there was another hard drive connected via USB. I gave the g4l live cd a shot. It saw the hard drive but would fail to copy.
Then I tried a knoppix live cd and all worked well. Then I used gparted live cd to do the partition resizing. All went perfect.
Just throught I'd throw that out there for people trying to clone a drive connected via USB. You may have to use Knoppix instead of gparted live cd and then just follow the directions listed in the first post.
saikee
10-16-2008, 03:36 AM
drsatch,
I rather think your problem is hardware related.
It is a common fault that if a USB hard disk isn't properly powered then it may fail to be picked up by some operating systems.
The maximum power supply to a USB port is 0.5 Amp. Just about every 2.5" hard disk above 20Gb capacity would be using 0.5 to 1 Amp consumption range. A properly kitted out external 2.5" hard disk enclosure would have a twin head USB cable supplied for drawing power supply from two USB ports.
If you are using a twin head cable and the distro is a recent one then your USB hard disk should be seen by every Linux.
If you use a single head USB cable then the hard disk read/write operations are simply "unreliable". Sometimes it works but sometimes it doesn't. This is not an operational problem.
Can you confirm what cable you were using?
Also the best detection is at the terminal using command in root
fdisk -l
drsatch
10-16-2008, 01:13 PM
You're exactly right. It was a twin head. I was using 1. Never thought about the power requirements. Just thought it was strange that parted magic and gparted iso's wouldn't see it, but the knoppix one did. I did use the command line to find the disks also.
It's exactly as you said...sometimes it works using one lead, sometimes it doesn't.
In my case, it did. All is well in my world.
saikee
10-16-2008, 04:47 PM
drsatch,
Thanks for the confirmation.
AD Johnson
10-16-2008, 09:43 PM
I just want to thank you for talking to us, like the children we are. Not all of us was born with this embedded in our brains. About 2 minutes ago I completed my first XP migration. Your instructions were simple and to the point. The only issue I had was that the code you gave , ( dd if=/dev/hda of=/dev/sda bs=32256) had to be changed to (dd if=/dev/sda of=/dev/sdb bs=32256) because thats the way terminal had designated it. Could you show a me a code, lets say , to single out one partition of a duel boot, with XP and linux, on a single drive. I think if I seen this it would better help me understand, this process . Thanks again AD johnson:cool:
saikee
10-17-2008, 03:41 AM
AD Johnson,
The safest way to clone a MS system, especially Vista, is to mirror a complete hard disk.
Thereafter if you want to change the partition arrangement do it with the Parted Magic or Gparted Live CD. This way you start with a workable system first, test it and then start messing around with the partition table. For Vista it is best to use its own resizer function within the "disk management" program. Parted magic and Gparted are alright for Xp.
To clone a partition just use the device name of a partition. In Linux the first partition of disk sda is sda1, the 3rd partition of disk sdb is sdb3. Therefore is you want to clone sda1 as a source to sdb3 as a target the instruction is just
dd if=/dev/sda1 of=/dev/sdb3 bs=32256
You need to do extra work to change some system parameter if you migrate a MS system or any operating system to a partition with a number different from its original. That is why I recommend cloning the whole disk first and alter its partition table later. Also you need to make sdb3 exactly in size, in exactly the same number of cylinders, as sda1 in order to be error free.
In general cloning a partition without an operating system (data only) is recommended for the above. However you might find creating sdb3 first, format it and then copy the content of sda1 into it is easier as you can have sdb3 in any size you wish.
Cloning with dd has the advantage of copying the boot sector which is not touched by programs copying the filing system.
If you want to know how each partition is called in Linux use a root console command
fdisk -l
Lastly it was not my intention to make my readers feel like children. However the operation is very simple but the theory behind is quite complicated. My intention was to make aware of the principles behind. To migrate an operating system by any standard is a big deal so there is no harm in stating each step clearly.
AD Johnson
10-17-2008, 09:12 AM
I Thank you for your quick response. It has shed a lot of light on the subject. Right now I'm trying the ( tar ) method in migrating .elyssa mint 5 to an external hard drive,just to see how it works. Again I thank you, I hope I did not offend you with my children statement, But when I go to some forums, they talk as if everybody's been doing this all they're lives. Nice to listen to someone who talks to us in a way we understand. Thanks
shortz
11-03-2008, 11:08 PM
First, this is a most helpful how-to. Much thanks to saikee and all who've contributed to this thread.
I've run into a temporary glitch trying to use this method and have a question:
Can the destination drive be booted from while still in the external enclosure and using a different interface (SATA vs. IDE) than the original drive? I can't seem to boot from the destination drive that I've copied the data to.
Here are the steps I've taken:
1) System: Dell Latitude D420, 60 GB IDE running XP Pro, external USB drive enclosure housing WD 74 GB SATA drive. Using Xubuntu livecd.
2) Fdisk output:
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x41ab2316
Device Boot Start End Blocks Id System
/dev/sda1 1 7 56196 de Dell Utility
/dev/sda2 * 8 7294 58532827+ 7 HPFS/NTFS
Disk /dev/sdb: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x39d1cc9a
Device Boot Start End Blocks Id System
3) dd command and output:
ubuntu@ubuntu:~$ sudo dd if=/dev/sda of=/dev/sdb bs=32256 conv=noerror
dd: reading `/dev/sda': Input/output error
14401+1 records in
14401+1 records out
464535552 bytes (465 MB) copied, 184.913 s, 2.5 MB/s
Displays i/o error three more times and continues processing.
I added the conv=noerror because the dd process would die upon hitting the error, where the noerror kept things moving.
I also found a useful way to monitor the dd progress at another site (forgot where, but I'll find/link-to it ASAP). In another terminal enter:
$ sudo watch -n30 -- pkill -USR1 ^dd$
The above will display the progress in the original terminal which the dd command was executed.
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x41ab2316
Device Boot Start End Blocks Id System
/dev/sda1 1 7 56196 de Dell Utility
/dev/sda2 * 8 7294 58532827+ 7 HPFS/NTFS
Disk /dev/sdb: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x41ab2316
Device Boot Start End Blocks Id System
/dev/sdb1 1 7 56196 de Dell Utility
/dev/sdb2 * 8 7294 58532827+ 7 HPFS/NTFS
ubuntu@ubuntu:~$
Looks good, but when I try to reboot the laptop via the external enclosed drive, BIOS says: A disk read error occurred, ctrl alt del.
XP comp mgmnt says: e:\ is not accessible. The file or directory is corrupted or unreadable.
Sorry if too much info. Any help or point in the right direction is appreciated.
--shortz
saikee
11-04-2008, 04:26 AM
shortz,
Welcome to JustLinux.
Xp or any MS Windows system does not support booting from an external device, except eSata that is factory-fitted at the rear panel or a specially hacked version.
Also it is not wise to have two Xp systems, with identical system files in any booting operation. It is much safer to remove one of the two disks and arrange it in exactly the same hardware condition as such information would have been embedded into the system during installation. This is to say it will not boot from e: if it was originally installed in c:.
As far as I can tell your original disk may have some corruption resulting reading difficulties with some sectors. The rest appears to have been successfully cloned.
Depending on the age of the laptop your old disk may be a Pata and the cloned Sata may not be physically fitted into its internal hard disk position.
If you intend to replace the hard disk get one that is of the same type. You can clone the 3rd disk from either of the two disks you have got.
shortz
11-04-2008, 10:32 AM
saikee,
Thanks for the quick and thorough response!
I did not know that XP could not boot from an external drive, with the exception of eSATA, etc. Good to know.
What I termed IDE (incorrectly) is likely PATA. Yes, the external drive is too large to fit into the laptop. My original plan was to backup XP, resize the NTFS partition smaller and install another OS for multiboot. In case I messed things up or wanted to return the system to original setup I hoped I could use the backup and dd from external drive to internal drive.
I will obtain a matching disk (interface, enclosure, etc) and try the backup and replace method next go round.
Again, thanks for all your help as well as the contribution from others on this thread!
--shortz
saikee
11-04-2008, 02:03 PM
The Dell Latitude D420 is a laptop. All laptops use 2.5" hard disk as oppose to the 3.5" size hard disk used in the desktop.
I would advise you to remove the hard disk of the laptop and check the connection. The IDE or Pata has two rows of pins whereas a Sata doesn't, otherwise the two look exactly the same externally. It may be possible for you to check the original spec to find out if it is a Pata or Sata hard disk.
Coyttl
12-16-2008, 02:57 PM
First off, wanted to give a big thank you to everyone here for comments and suggestions, and would like to get thoughts from those there on my situation.
I need to re-image drives quite often, and for my purposes I need to do the WHOLE drive. (All partitions, including boot record.) (If you REALLY need to know why, PM me. :D)
Because my images are stores on a CIFS mountpoint, speed and size is an issue. (i.e. I CAN do a dd if=/dev/sda of=/mnt/cifs/image.out but it would take quite longer than necessary.) So, looking at alternatives, 'partimage' will copy ''just what's filled'' on the drive. However, it only does partitions and not the whole drive.
So my proposed solution (working on now) is this, in high-level, using a custom Live Linux CD that will boot up into Text mode and run the following in a script:
1. Mount the network share.
2. Write the new partition table - sfdisk /dev/sda < table.txt
3. (Resync the table?)
4. Use partimage to restore all the partitions.
5. Use dd to write the first 1k (1024) bytes of the drive, to make sure the full MBR is there.
Again, this is high level, but does that seem like it has any huge holes in it? And, is there an easy way (other than rebooting) to resync the table? I saw someone mention "partprobe" but not sure if that'll do anything it needs to.
Thanks in advance all,
Mike.
saikee
12-16-2008, 06:42 PM
Coyttl,
Welcome to Justlinux!
I suppose your backup system is always bootle-necked by the network speed.
You idea of breaking up the hard disk image into parts should work as long as you make sure the first sector, which contains the partition table, is saved as part of the procedure.
I often back up a large hard disk, say 1 TB large, but only interested in the first partition. The quickest way is to "dd" the first sector out and put it on a say a smaller disk. The transferred partition table makes the smaller hard disk a outcast because its partition table points to higher number of cylinders the disk hasn't got and most partitioning software would not touch it. The fdisk program in Linux can be used to delete the unwanted partitions making the smaller disk "legal" again.
The partition table is the guide for program like dd to carry out cloning as each partition's boundary limit is adequately defined.
Thus if you restore the first sector, only 512 bytes by command
dd if=/dev/sda of=/mnt/sda_1st_sector bs=512 count=1
You can restore any partition in piece meal fashion.
You do need to make sure the partition table isn't altered.
Also if you use logical partitions and LVM it will be necessary for you to adhere to the partition layout rigidly as these partitions addresses are hard-coded between partitions and not inside the first 512 bytes.
Coyttl
12-16-2008, 06:52 PM
I suppose your backup system is always bootle-necked by the network speed.Right now that's true, and as soon as I get everything 're-imaged' to a new, more useable fashion, the net's going to be upgraded to a fiber backbone to speed up data transfers. :) But that's a little ways off...
You idea of breaking up the hard disk image into parts should work as long as you make sure the first sector, which contains the partition table, is saved as part of the procedure.
I often back up a large hard disk, say 1 TB large, but only interested in the first partition.
...
The partition table is the guide for program like dd to carry out cloning as each partition's boundary limit is adequately defined.
Yeah, I got that.. In my case, since we're doing software testing on many different flavors of OSes (mostly Windows), sometimes I need the entire disk (read: All partitions and data. Empty space I don't care about) since an OS on a machine from a manufacturer may have a "backup" or "data" partition. Unfortunately, I gotta save those as well.
Thus if you restore the first sector, only 512 bytes by command
dd if=/dev/sda of=/mnt/sda_1st_sector bs=512 count=1
Ah, okay! So I can use these commands together:[CODE]sfdisk < partitions.txt
dd if=/dev/sda of=/mnt/sda_1st_sector bs=512 count=1[/COUNT]..instead of saving 1024 bytes, I only need the first 512... Right?
You can restore any partition in piece meal fashion.
Also if you use logical partitions and LVM it will be necessary for you to adhere to the partition layout rigidly as these partitions addresses are hard-coded between partitions and not inside the first 512 bytes.
I'm not two worried about ever having to change partitions - since the main point of my imaging is to 'restore an operating system back to it's fresh standing' without the software we're testing on it, the drives themselves will never change.
My main concern for this whole process I mad-scientist-formulated was because of MBR issues and my old way of imaging. Newer OSes (Win08, Vista) didn't like my previous imaging way. Add newer AHCI controllers to the mix, and I'm dead in the water on newer machines now. Hence, my foray into handling it this way. :)
thanks for the pointers!
Mike.
bwkaz
12-17-2008, 12:40 AM
2. Write the new partition table - sfdisk /dev/sda < table.txt
3. (Resync the table?) Not if sfdisk is at least halfway intelligent. (Though I don't know whether it is.) If it's at least halfway intelligent, then it will send the proper ioctl to /dev/sda for you, so that the kernel re-reads the (new) partition table off the disk. The only way this should ever fail is if any other partitions on the disk are currently mounted.
The partprobe program does send this same ioctl -- but if sfdisk is doing it for you, you don't need partprobe. ;)
Coyttl
12-17-2008, 10:15 AM
Not if sfdisk is at least halfway intelligent. (Though I don't know whether it is.) If it's at least halfway intelligent, then it will send the proper ioctl to /dev/sda for you, so that the kernel re-reads the (new) partition table off the disk. The only way this should ever fail is if any other partitions on the disk are currently mounted.
The partprobe program does send this same ioctl -- but if sfdisk is doing it for you, you don't need partprobe. ;)
Thanks for that. I'll test it later today and see what happens. I have more than a few systems I can (potentially) destroy. :)
I'll post what I find (for anyone else's reference..)
TarsTarkas
01-04-2009, 02:27 PM
Very useful topic - so far! I've succesfully migrated my XP installation from an 80GB IDE to a 250 GB SATA. Due to errors on the disk I did have to use ddrescue rather than dd but I got there eventually and it all boots up just fine.
However, resizing the cloned partition has not been so easy. the new disk shows up as having one NTFS partition of 80GB and the rest as Unallocated space. I've tried using Gparted and the Parted Magic Live CD but nothing seems to allow me to expand the existing partition to take advantage of the additional space on the new drive. I am allowed to set up the new partition size but when I "apply" the operation I get a rather unhelpful message telling me that the operation couldn't be performed.
From the description of the migration process detailed at the start of the thread there is no indication that this operation should present any problems but all my attempts to accomplish it have met with failure.
Am I missing something obvious?
saikee
01-04-2009, 06:22 PM
TarsTarkas,
Welcome to Justlinux!
Xp from a 80Gb disk source to a 250Hb disk should be plain sailing. The expansion of 80Gb to 250 should take about a minute or two as only the right hand side boundary is changed and the filing system can remain unmoved. I believe the operation only adjusts the end point of the hard disk and generates the indexing system for the NTFS filing system between 80 and 250Gb space.
I would suggest you defrag the Xp partition first, use Gaprted or Parted Magic to drag the right boundary from 80Gb to 250Gb and give the green light to go ahead.
If you still have a problem post the disk management details here (i.e. telling us how manay partitions and where they are primary or logical.)
The resizing may not work with encrypted filing system though.
TarsTarkas
01-05-2009, 03:58 PM
Hi Saikee!
Many thanks for swift response. I've subsequently defragged my disk (three times to make sure there are no red bits left) and retried Parted Magic but I still get the same error. Here's the details:
GParted 0.4.1
Libparted 1.8.8
Grow /dev/sda1 from 76.68 GiB to 116.45 GiB 00:00:00 ( ERROR )
calibrate /dev/sda1 00:00:00 ( SUCCESS )
path: /dev/sda1
start: 63
end: 160810649
size: 160810587 (76.68 GiB)
calculate new size and position of /dev/sda1 00:00:00 ( SUCCESS )
requested start: 63
requested end: 244204064
requested size: 244204002 (116.45 GiB)
new start: 63
new end: 244204064
new size: 244204002 (116.45 GiB)
check file system on /dev/sda1 for errors and (if possible) fix them 00:00:00 ( ERROR )
ntfsresize -P -i -f -v /dev/sda1
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 82335019520 bytes (82336 MB)
Current device size: 82335020544 bytes (82336 MB)
Checking for bad sectors ...
Bad cluster: 0x50829 - 0x50829 (1)
Bad cluster: 0xdd0f92 - 0xdd0f92 (1)
ERROR: This software has detected that the disk has at least 2 bad sectors.
************************************************** **************************
* WARNING: The disk has bad sector. This means physical damage on the disk *
* surface caused by deterioration, manufacturing faults or other reason. *
* The reliability of the disk may stay stable or degrade fast. We suggest *
* making a full backup urgently by running 'ntfsclone --rescue ...' then *
* run 'chkdsk /f /r' on Windows and rebooot it TWICE! Then you can resize *
* NTFS safely by additionally using the --bad-sectors option of ntfsresize.*
************************************************** **************************
========================================
I followed the advice and ran "chkdsk /f /r", rebooted twice then reattempted to resize the partition but the bad-sectors are still reported. The information above asks me to run ntfsresize to resize the file system but I'm unsure how I can do this without first increasing the size of the partition ...
... or are they the same thing?
saikee
01-05-2009, 07:12 PM
If you have bad sectors in the hard disk then these can be corrupted patches which are not readable or writable. This is a hardware problem and can only be the case if you are using a used 250Gb hard disk.
A brand new disk should not have bad sectors. I certainly have not run into one of such disks myself.
TarsTarkas
01-06-2009, 01:21 PM
If you have bad sectors in the hard disk then these can be corrupted patches which are not readable or writable. This is a hardware problem and can only be the case if you are using a used 250Gb hard disk.
That's a little disturbing since the 250Gb drive was purchased from PC World a month ago (today) with no indication that it was either second hand or refurbished. I bought it to replace the 80Gb drive which did have bad sectors and was generally getting a bit creaky.
Now if you'll pardon my ignorance as to how dd and dd_rescue actually work, but if either command is just making a "dumb" copy of the original drive is it possible the bad sectors have been copied "intact" from the original drive. I believe that bad sectors are marked as "no-go" areas and I'm guessing that the cloning process simply copied over the marker flags. If this is case would you know how to "unmark" them.
Failing that, it'll have to be a trip back to PC World. What a pain! Glad I held on to my receipt.
Many thanks for all your help, however it turns out. 'Tis much appreciated!
saikee
01-06-2009, 07:03 PM
dd has an option to proceed after encountering an error. My guess is dd_rescue may do a bit more.
If you copy from a source with bad sectors the defective areas cannot be read and it would not be copied but just left blank on the target disk. The blank area should have no problem to be read and written. Only when the file is being used then the missing information would be shown up.
Technically the bad sectors cannot be transferred and that is certainly my experience when cloning dying disks.
If the disk is bad the defective areas will be reported by any cloning software. You can try one from Windoze like Ghost or Acronis. dd just copies the binary pattern of "1" and "0". It is a pretty basic operation. The good thing about it is the resident operating system is not used and its type, health and defects are immaterial to the cloning operation.
Dylanspiritwind
02-13-2009, 07:32 PM
The dd method is solid and simple and resolved my first question of whether or not I could migrate my system as is to a larger hard drive; two quhow to migrate linux system to a new driveestions still:
1. I have been reading about increasing speed and optimizing ubuntu for laptops and wanted to change the default ext3 file system to xfs or or another faster file system. Is this possible to do before or after the dd process?
2. Is it possible to use this method to create a bootable sd card of a current ubuntu setup? how to migrate linux system to a new drive
saikee
02-14-2009, 08:34 AM
Dylanspiritwind,
Welcome toi Justlinux!
In answering your questions
(1) All information are stored in binary bits of either "1" or "0" on a hard disk so the filing system and the operating system is immaterial. In your case you can do either because one of them is your backup so you can do whatever you want even damage the second disk without any consequence to your original system. Thus it may be easier to have two ext3 disks before proceeding to turn one of them into the xfs filing system.
(2) The answer is yes but it is a lot easier and quicker to use Ubuntu to do it in terminal mode. The details are available in this thread. (http://www.justlinux.com/forum/showthread.php?threadid=150643) Forgive me if I do not repeat them here. Just follow the suggestion to put Grub into a pen drive. If you don't want to read it I believe if you insert the sd card and it is recognised as device sdb1 then the Bash terminal command
grubinstall /dev/sdb1
should be able to achieve the same but I am not sure if it wipes away the existing data in the SD card.
Migrating Linux is easier than cloning it and you can do it with itself but the safe way is always booting up a Live CD leaving the original system dormant so that its system files are not in active use.
Key steps are (let us know if you need the missing commands)
(a) Do it one partition at a time.
(b) Just create and format another target partition of any size and any filing type (same filing type is always the best).
(c) Mount both source and target partition. (assuming the source is /dev/sda3 mounted on /mnt/sda3 and target /dev/sdc3 mounted on /mnt/sdc3)
(d) Change directory to the source /mnt/sda3 (not mandatory but the command below is written assuming you do it) and then copy the entire filing system across by command
tar cf - . | (cd /mnt/sdc3; tar xf -)
(e) Do whatever necessary to update /etc/fstab to point to the new target partition by keeping or removing the source partition.
(f) As a rule duplicating a file system using a "copying" command does not copy the boot sector and so the boot loader must be updated separately. dd is the only command that includes the boot sector.
Dylanspiritwind
02-15-2009, 01:48 PM
Thank you for your quick reply!
I did read the link, but it is a bit over my head, are they doing that in grub?
So my sd card comes up (in diskpartitioner) as sda2 but has 2 partitions on it called sdb1 and sdb2, I am not concerned about any information on it so would I use the command grubinstall /dev/sda2? Being that I have only 1 sd slot to boot my live ubuntu from and no cd/dvd Im not sure I can use the dd command from outside my running system.
My system is basically as follows:
eee 900ha (thus no optical drive)
160gb hd that is partitioned to dual boot (still have the xp on there even though I never use it) and partitioned:
Sda1:[/B] ntsf/windows
Sda2: sd card
sda3: says unknown, 40 mb?
sda4: extended:
I believe those are my 4 primary partitions?
under sda4 it shows: sda5: ntfs, 235mb, not sure what this is for?
sda6: I think this is my primary linux partition, it has 7.11gb used (will that fit on a 8gb sd card?
sda7: linux swap
sda8: fat 32: this is my partition that holds all my documents/music/videos/etc.
So after installing grub onto the sd card,
(a). which partitions do I need to copy
(b). Im not sure I understand the other steps needed here, do I need to do any formatting to the sd card?
(c,d,f): This is a cf command and is tarred, would it be easier to use the dd command instead here?
(e). Im not sure I understand this.
After using Linux for a year, I guess im still a NooB,
My goal here again: I just want a bootable backup of my eeebuntu os (I have a bootable copy of the original, just want one with all the tweaks I've made), I could settle for a dd backup that I could restore but it would be re-assuring to be able to boot into my system instead of the original version.
After some searching I found remastersys to create a custom .iso image, could I simply do that then boot into windows and use unetbootin to creat that on a flash drive? I think I will try that now:)
If this same result would be possible using the dd command it would be nice, the remastersys does allow to "reinstall" the system just like a live cd when booting from it which is even more ideal for a beginner like me.
Thanks in advance!
saikee
02-15-2009, 08:47 PM
Your sda2 should not be a SD card.
The information suggests that you have two disks; one sda (a hard disk) and a SD card called sdb.
I think I have been confused by you as I thought you just want a bootable SD card containing Ubuntu settings. To me that can only be the boot loader Grub and nothing else. If you want the SD card to contain a full working Ubuntu then it is something else.
You will need to check the Ubuntu forum on making a SD card version as it doesn't appear to be available from the general release the last time I tried it.
In your case you would be better to resize the partition to squeeze some hard disk space to create say sda9 and put the second Ubuntu there. The second can share the swap partition and just one partition will suffice. You can boot it as another choice in the Grub menu.
The problem with booting from an SD card is you must nominate the sd card as the first bootable disk before the PC Bios drops the booting to the hard disk. Therefore the SD card will take the sda device name and the internal hard disk is relegated to device sdb. You may have to change the internal settings when using the SD card and then revert back to the original setting if booting the internal hard disk first. You end up with more trouble than its worth.
Putting two Ubuntu into two partitions simplifies everything.
Dylanspiritwind
02-15-2009, 09:51 PM
You were so right, I am a bit too *****ious for my own good,
The theory worked great, Using Remastersys to create the iso image then unetbootin to make a bootable sd card, but my sda 2 was not the sd card....
So now my computer boots with the unetbootin version (I presume off of sda2, as the sd card is empty) but I have lost my ability to choose between the original version on sda6 and my windows on sda1. I think this method should work once you have the iso (I used unetbootin to installl eeebuntu in the first place, I dont see how it could be any different), just dont make the same mistake I did, I hope I can salvage my original grub menu (or boot menu?).
I will look for help in another forum that is more on this topic, thanks!
teeitup
03-05-2009, 02:36 PM
I just got done replacing the disk in my Dell Inspiron laptop. Since I dual boot between XP and Linux the original 80GB drive was becoming cramped.
Dell said a 120GB drive was the largest I could use. My local computer store was willing to let me try a 320GB drive and return it if it didn't work.
The basic clone procedure in the first post worked fine. Took about 90 minutes and the new disk booted to both XP and Linux.
The problem was that I was unable to use the additional space.
I won't detail all of the things I tried before the epiphany.
It's important to remember that laptops from vendors have special partitions for various purposes. I used Partition Magic when I made room for Linux when I first got the Laptop. I also created a "fat32" partition so that I could share files between the two OS's.
While setting this up I used up the primary partitions and created an extended partition for Linux and Swap. It wouldn't let me resize the extended partition.
This is what created the problem stated above. I didn't want to disturb the factory partitions. The main goal was to not have to reinstall windows, just give it more space.
Part of the reason for wanting extra space was to be able to install more than one Linux distro. I was willing to blow away Linux and reinstall. Installing Debian and getting 90% of what I need takes a little over an hour. With the recent release of Lenny and the fact the you can get install disks with your choice of desktop, XFCE, GNOME, and KDE, I wanted to try the XFCE version.
Of course after deleting the extended partition the laptop wouldn't boot anymore. Grub would fail due to the menu.lst file now missing. I had total confidence that the Linux install would find XP and set-up Grub appropriately. It did!
Windows did run CHKDSK when it was first booted due to the new larger space.
Everything is working great. I just have to change the sources to "testing" and do a distribution upgrade.
This turned out to be a great learning experience. The information in this thread was helpful. I wanted to add my lesson of what might happen if the disk you're trying to clone has used up it's primary partitions and also has an extended partition. It adds complication and some additional planning is needed. The beauty is that the original disk was always safe. I could mess up the new drive without fear that I could start over.
Thanks,
saikee
03-05-2009, 07:00 PM
teeitup,
Glad you find the procedure works for you.
To expand an extended partition is more complicated. If the OSes are Linux you don't need to clone them. Just use the tar command and then restore the boot loader one by one.
It is a good practice to put the extended partition at the rear end of a hard disk. This way you can expand it easily.
teeitup
03-05-2009, 07:18 PM
I did have the extended partition at the end. I thought it was going to be a no brainer. I was disappointed and a little concerned that my original plan didn't work. The idea of 320GB of disk space had grown on me and I didn't want return the disk.
I found it interesting that the extra space was identified as "unusable" and not "unallocated". This was true in GParted and cfdisk.
Thanks,
saikee
03-05-2009, 07:52 PM
teeitup,
The hard disk has a standard that every OS uses. One of the standard features is the 4 primary partitions. Basically you can have only more partition by giving up one primary and turn it into an extended partition.
Inside the extended partition, which is just a boundary, you can have 11 logical partitions (pre-2.6.28 kernel) or 59 logical partitions (post 2.6.28 kernel). The logical partitions must be consecutive because the ith partition carries the address for the i+1 partition. If you delete say the 7th partition the space is dead but the Linux will shift the 8th partition and above up by one space so that the old 8th becomes the new 7th, old 9th become the new 8th etc to maintain the consecutive order, even without telling you!
If you have space outside the above convention no operating system uses it. That is all.
Therefore in your case if you have dead space after the end of the logical partitions you can delete a couple of them and move the boundary of the extended partition to take up the dead space.
Dead space can be easily absorbed by primary partitions but it is more tricky with logical partitions because of the convention. There is a reason for it. If you study the convention you will agree that is the optimum way.
gamblor01
09-20-2009, 12:43 AM
Saikee,
Great thread as always, though I could use your help. I have a drive that is failing on me. My Fedora partition no longer boots and fsck ran overnight without completing. :/
So, I recently purchased a 500GB drive and planned on cloning my main Linux partition (on /dev/sdb3) over to this drive. The layout is like so (after creating/formatting a 250GB partition on /dev/sdc):
Disk /dev/sda: 400.0 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2b7a2b79
Device Boot Start End Blocks Id System
/dev/sda1 * 1 48640 390700768+ 7 HPFS/NTFS
Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000ebf86
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 8355 67111506 83 Linux
/dev/sdb2 8356 8486 1052257+ 82 Linux swap / Solaris
/dev/sdb3 8487 24421 127997887+ 83 Linux
/dev/sdb4 24422 30401 48034350 5 Extended
/dev/sdb5 24422 30401 48034318+ 83 Linux
Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x93c8bb99
Device Boot Start End Blocks Id System
/dev/sdc1 1 30394 244139773+ 83 Linux
What I would like to do is to copy /dev/sdb3 over to /dev/sdc1. So I booted up the Ubuntu install on /dev/sdb5, mounted sdb3 and sdc1, and then tried the following:
$ cd /media/sdb3
$ tar cf - . | ( cd /media/sdc1; tar xf -)
It doesn't work, and the terminal output shows the following:
tar: ./var/lib/dpkg/alternatives/javaws: Cannot open: No such file or directory
tar: ./var/lib/dpkg/alternatives/jstat: Cannot open: No such file or directory
tar: ./var/lib/dpkg/alternatives/jmap: Cannot open: No such file or directory
tar: ./var/lib/dpkg/alternatives/ControlPanel: Cannot open: No such file or directory
It displays this same message for every file on the entire sdb3 partition. I'm not sure why it would say that either -- clearly the files exist! Did I miss something here?
saikee
09-20-2009, 07:25 AM
I couldn't fault your commands and the method is what I would use normally.
However if your 250Gb disk sdb is failing then it is possible that filing access will be impeded by the corruption developed.
Since sdc is 500Gb and larger than the 250Gb of sdb a btter strategy is to clone the entire disk by
dd if=/dev/sdb of=/dev/sdc bs=32256
AFter the cloning you remove the sdb and hook the 500Gb disk at its position.
This arrangement has the following advantages
(1) The 500Gb will function exactly if not better than the 250Gb. The better comes from no corruption as the damaged areas are just bad data instead bad hardware.
(2) The new 500Gb will boot normally and any undamaged partitions will function perfectly. Thus you can use Ubuntu same as before.
(3) You test the distressed Fedora. If it boots then the damaged is not serious. In any case you can execute repair with it.
(4) The original sdb is a backup.
(5) You can use gparted to expand the partitions later on.
This scheme does require more work if you resize the partitions but you should be aware of the fact if sdb has corruption the whole disk will eventually go south. Also instead of resizing sdb3 you can always make new sdb6 or sdb7 of any size you want and migrate sdb3 to there without resizing any partition.
gamblor01
09-20-2009, 09:19 AM
Well I was actually planning on just trashing Fedora. It was a Fedora 11 install that I had just put on there to play with, so there isn't much on there. I guess I could copy just the partition instead of the entire drive. So right now sdb3 is a 128GB partition and sdc1 is a 250GB partition. Will this work as-is without needed to expand the partition, or will I need to pop in gparted and expand sdc1 after copying?
dd if=/dev/sdb3 of=/dev/sdc1 bs=32256
If it needs expanding, does that mean that I need to destroy sdc1 and recreate it as a 128GB partition, clone sdb3, and then expand? Or is it acceptable to clone it over to the 250GB sdc1 that already exists and then just expand?
saikee
09-20-2009, 10:54 AM
If you clone a partition or the entire disk using dd then you must remember it is a hardware type copying. In it the cloning procedure is controlled by counting sector by sector. This effectively means you can only use dd if the target disk is bigger than the source disk. And in the case of partition-to-partition cloning you need to ensure both partitions are indentical in size, down to the exact number of sectors. Disk-to-disk cloning is a lot saimpler and easier because there is nothing to do except making sure the target is exactly the same size or just larger.
Therefore dd should only be used for sector-by-sector cloning.
If you use tar then it is "the filing system" that get copied so the size of the partition is inmaterial! You do have to format the partition first before you can use tar. For dd you don't even need to bother with the partition table, let alone formatting each partition. So the two are totally different methods.
Linux can be copied from partition to partition without problem as long as you know how to mount the partitions using /etc/fstab and updating the Grub's menu.lst if the partition is used for booting.
I would not recommend you to use dd if the partition content can be migrated using tar. dd is good if you want simplicity (like cloning the whole disk) and the disk is actually having a read/write error (dd does not deal with the files, it copies the binary bits). If you clone the entire disk then the existing sdc1 will be overwritten.
LewRockwell
09-21-2009, 09:28 AM
It should be noted with respect to hard drive catastrophies:
Each time you power it up...may well be the last time you successfully do so
With that in mind you MUST have an effective plan to immediately rescue your most valuable data FIRST
This involves the following:
Do not allow the drive to be energized until you are absolutely ready
Do not allow others to accidentally energize the drive in your absence
Do not EVER boot from that hard drive again(until everything of value is rescued at least)
When you do energize the drive be prepared to immediately go directly to the most valuable data first and get it copied to a safe location immediately
Do NOT attempt to copy the whole drive
GO GET YOUR VALUABLE DATA FIRST!
A large portion of the data on the drive is of absolutely no serious value
You can easily replace the operating system and each and every piece of additional software and/or driver
Again, operate under the assumption that the drive will only last another ten minutes
Go to your most irreplaceable data FIRST and rescue it immediately
The biggest mistake we see at the service counter and technician's bench is making the assumption that the drive is going to stay operational through ANY specific process
As the owner of the equipment, consider that each time you turn your machine on...that may be the last time the system operates properly and without any losses
Hence our worldwide web battlecry...BACK IT UP! SECURE YOUR DATA!
And for the technician and hobbyist the same holds true and is even MORE important
You must demand that your friends and patrons give you a list of EXACTLY what must be rescued
You must demand BOTH what must be rescued AND the order of value(and hence the order in which data will be rescued)
You must proceed ONLY after an effective and complete plan of action is determined
Otherwise you will either be physically transplanting your platters into another hard drive to retrieve the data...
Or...
You will be paying someone else big money to do it for you
Again...
You have been warned!
So...
While your hard drive is operating perfectly fine, start backing-up anything and everything that you can't afford to lose FOREVER
As always, your mileage may vary, buyer beware, and buyer be aware
We now return you to your regularily scheduled programming
.
gamblor01
09-21-2009, 10:29 PM
LewRockwell -- what a post!
I will say that I have already backed up all of my important stuff already, so I definitely have that covered. Thanks for the advice though. ;)
gamblor01
09-22-2009, 11:29 AM
What I would like to do is to copy /dev/sdb3 over to /dev/sdc1. So I booted up the Ubuntu install on /dev/sdb5, mounted sdb3 and sdc1, and then tried the following:
$ cd /media/sdb3
$ tar cf - . | ( cd /media/sdc1; tar xf -)
It doesn't work, and the terminal output shows the following:
tar: ./var/lib/dpkg/alternatives/javaws: Cannot open: No such file or directory
tar: ./var/lib/dpkg/alternatives/jstat: Cannot open: No such file or directory
tar: ./var/lib/dpkg/alternatives/jmap: Cannot open: No such file or directory
tar: ./var/lib/dpkg/alternatives/ControlPanel: Cannot open: No such file or directory
Just a heads up for Saikee and everyone else, this appears to have failed because I was trying to sudo it like so:
$ sudo tar cf - . | ( cd /media/sdc1; tar xf -)
This failed with the errors I mentioned above. On a whim I thought that perhaps running sudo -i and then retrying the command would work...IT DID! So make sure you are truly root and not just trying to run the command via sudo.
So, the complete set of steps I ran to copy all files from /dev/sdb3 to /dev/sdc1 was:
$ sudo -i
# mkdir /media/sdb3
# mkdir /media/sdc1
# mount /dev/sdb3 /media/sdb3
# mount /dev/sdc1 /media/sdc1
# cd /media/sdb3
# tar cf - . | ( cd /media/sdc1; tar xf -)
I have been checking it and it is definitely copying everything over. I might need to reinstall grub on the drive (though the tar command should be copying over all of the /boot/grub directory, though my UUID will change as will the partitions), and I also need to create a swap partition. Then I should be able to disconnect sdb and put sdc in its place, boot it up, and hope for the best! I'll post an update later today.
saikee
09-22-2009, 11:49 AM
If your sdc1 is a self-contained Linux then it can be booted up without the swap partition but adding a swap does no harm. You will need to do the following tasks
(1) Best way is to use a Linux Live CD, any one would do.
(2) Boot up the Linux Live CD and mount sdc1 which will become a different device if the original sdb is withdrawn. Edit it /etc/fstab to reflect the new partition referece of the swap and the root partition of the Linux. Forget about the UUID as you can survive without it.
(3) Edit /boot/grub/menu.lst to reflect the Linux is in the 1st partition of the ?th disk.
(4) Restore Grub
Then your Linux should boot fine afterward.
gamblor01
09-25-2009, 09:08 AM
Well unfortunately it didn't work. I tried to boot up the drive and it looks like everything is working fine. However, when it starts loading Ubuntu it uses the text based mode instead of the little scrolling bar, and it just hangs when starting CUPS. It says that it's done (i.e. it says starting CUPS and then I see [ok] printed on the right side of the screen) but then it just sits there for eternity. I let it go for over an hour and it was just hanging.
So then I tried copying the entire drive over using:
dd if=/dev/sdb of=/dev/sdc
and it said that it failed after transferring 21 gigabytes. I guess that sdb1 partition (Fedora) is really hosed...so much so that it won't let me even copy it with dd.
I did stumble upon a much better laptop at work however, so I wanted to transfer everything over from my existing laptop to the new one. The copy process (using dd) worked pretty well except that wireless doesn't work and it doesn't seem to want to use the proprietary nvidia drivers. I'll start a new thread for that but I used dd over an nfs mount and it worked perfectly.
I basically just turned on my existing laptop, booted up a live CD, mounted the NFS share, and then ran:
dd if=/dev/sda of=/foo/foo.dump
Once it finished I fired up the live CD on my new laptop, mounted the NFS share, and then ran this:
dd if=/foo/foo.dump of=/dev/sda
It worked! Oh and FYI, while in the Ubuntu 9.04 live CD, I had to run "sudo apt-get install portmap nfs-common" before I could mount the NFS share.
gamblor01
09-25-2009, 03:52 PM
Ok so after using the tar command to copy failed, I tried just doing a direct clone of the drives. Here is the exact error that I'm getting. Since sdb is a 250gb drive, I don't think that cloning 20GB is sufficient...
ubuntu@ubuntu:~$ sudo -i
root@ubuntu:~# dd if=/dev/sdb of=/dev/sdc bs=32256
dd: reading `/dev/sdb': Input/output error
632503+1 records in
632503+1 records out
20402040832 bytes (20 GB) copied, 622.65 s, 32.8 MB/s
saikee
09-25-2009, 05:12 PM
This command
dd if=/dev/sdb of=/dev/sdc bs=32256 conv=notrunc,noerror
Instructs dd not to truncate the files and keep on going even there are errors
You will get the whole disk cloned but some files may have holes if the original has corruption. You can read the man page of dd for the further explanations.
gamblor01
09-26-2009, 01:22 PM
Well Saikee thank you for all of your wonderful help, but unfortunately it looks like I'm just going to have to reinstall and copy all the data over. Even the notrunc, noerror options couldn't save me. It just started spitting out output like crazy to the terminal and then eventually hung. Oddly enough, when I checked fdisk -l after that, sdb was gone and the kernel now saw it as sdd?? I'm not sure what was up with that. There just was no sdb drive anymore (even though it was named sdb before I ran the dd).
In any case, thanks for the fine help. I guess I'll try cool stuff like this later on a working system with a hard drive that isn't toast!
saikee
09-27-2009, 05:44 AM
gamblor01,
It does sound that you have left it too late to salvage the disk.
I believe there are several threads in JL that you can search to try out different combinations.
I do echo the sentiment in the Post #119 by LewRockwell. When you to start to salvage a hard disk you should have a strategy. Repeated attempts without premeditation do accelerate the deterioration of the disk.
gamblor01
09-30-2009, 10:46 PM
gamblor01,
It does sound that you have left it too late to salvage the disk.
I believe there are several threads in JL that you can search to try out different combinations.
I do echo the sentiment in the Post #119 by LewRockwell. When you to start to salvage a hard disk you should have a strategy. Repeated attempts without premeditation do accelerate the deterioration of the disk.
Well thank goodness I already had the entire thing backed up then. At least, I had the only partition that I actually cared about backed up in its entirety thanks to the "tar cf - . | (cd /some/dir; tar xf -)" command! Good thing too -- that partition had my entire Facebook application that I have been working on for my thesis. I'm already cutting it close and unsure if I will graduate this semester. I have a backup but it's quite old. If I lost those files I would have gone berserk!!!!
Time to make backup copies of all of my code and all of my latex files for my thesis...
Big Olmec Head
11-20-2009, 03:10 PM
I followed your instructions on page 1 of this topic on a special project. My system is a dual boot rig with xp and win 7. Since I wanted to migrate everything to bigger hard drive, (from 160 gb to 1 tb) I followed your tutorial and I was all set in about an hour!!
My intention also is to tell people that dual boot system pose no problems with your instructions.
Thanks for the fine job!!
:D
The Big Olmec Head
saikee
11-20-2009, 05:24 PM
Big Olmec Head,
Welcome to Justlinux!
JReese
01-01-2010, 06:44 PM
Great tutorial and information in this topic. I really haven't cloned anything before and while searching for software solutions from the "big name companies" I stumbled on this and I was greatly surprised to read how easy the process might be.
I am looking to migrate a laptop (Latitude E5500) hard drive (Seagate 160GB) with a ton of software on it to a new larger drive but then add another fresh install of XP onto it for a dual or possible triple Windows XP boot system in the near future (for software version issues). However, to just get the clone worked out first I stuck the new drive (WD 320GB) in an external USB enclosure, booted up the system with the Parted Magic CD and cloned the drive with no issues at all overnight. I then took out the original hard drive and stuck in the new one and the system booted right up and seemed to function fine.
However, now after looking into a few things I have a few issues. Since the original drive was only 160GB, the new drive partition is 160GB and upon looking in Computer Management there is no drive other than my optical drive shown in Disk Management. Also, when trying to run the standard Windows Disk Defragmenter I just get an error stating it can't start - but the drive is seen by Disk Defragmenter. Also, when trying to run chkdsk I get an error stating it can't complete the task and it won't even attempt it. I was going to try getting into the Recovery Console to run FIXMBR and FIXBOOT but I can't get the Recovery Console to successfully load either by CD or by installing it on the hard drive and accessing it through the Startup Options. Also, PowerQuest Partition Magic 8.0 fails to run with an error of "Partition's drive letter cannot be identified".
All programs seem to run fine and I can access the hard drives C: partition fine through Windows Explorer but it seems that I can't do any management tasks involving the hard drive. Does anyone have any input on how I can troubleshoot or solve these issues? Thank you in advance.
saikee
01-02-2010, 01:08 PM
JReese,
Welcome to Justlinux!
and
Happy New Year.
We need to know your partitioning scheme become able to comment on what you are doing. You can be assured that cloning the hard disk cannot possibly alter your operating system.
The best information on your hard disk is obtainable in a root Linux terminal using command
sudo fdisk -l
or
fdisk -l
if you are logged in as a root user (equivalent to admin in MS Windows).
The Fixboot and fixmbr are only needed if you have Linux occupying the boot sector and MBR repectively but want to revert back to the equivalent in MS Windows.
I would strongly recommend using only one partitioning tools and stay away from the PowerQuest's Partition Magic. It is known as Partition Tragic and spread out hard disk corruptions because PowerQuest does not understand partitions other than MS systems.
Linux on the other hand supports 100+ partition types. Partition Tragic can report a healthy hard disk with errors in the partition table. If you allow it to alter it then you could suffer hard disk corruption. I would say about 20 to 30% hard disk problems reported in various forums are courtesy of Partition Tragic. You can run it but don't take up its advices if you run non-MS partitions.
If your partitions are reported by the disk management then they are healthy. MS is the first operating system to abandon a hard disk if it has an error in the partition table. Linux is the last one to do the same. So Linux is a much better tool and utility when it comes to salvage and save information in a hard disk.
After you clone the 160Gb into the 320Gb there should be 160Gb unallocated space. This space can be turn into partition "only" if you have not used up all the 4 primary partitions. If you have used up all 4 primaries then you need to reorganise the hard disk.
You can put any number of Xp copies (assuming from the same license or different licenses) in a hard disk but you can only run one copy at a time and hide the rest.
I have run 126 copies of Xp (http://www.justlinux.com/forum/showthread.php?t=152578) in a 1TB hard disk before! You can run a BAT file in Dos to control the booting or use a script file in Linux. The latter is easier. If you have less than 6 MS systems then Grub is totally capable of booting them for you as Grub can hide and unhide partitions.
JReese
01-04-2010, 12:55 AM
Thanks for the reply.
Below is the contents from "fdisk -l" from the Terminal in Parted Magic.
root@PartedMagic:~# fdisk -l
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa42d04a3
Device Boot Start End Blocks Id System
/dev/sda1 1 10 80293+ de Dell Utility
/dev/sda2 * 11 19456 156199995 7 HPFS/NTFS
And just to reiterate the main problem here is that my partition is NOT showing up in Disk Management. I can tell by the properties of my C: drive that it is only 160GB so I am aware that I have unallocated space and I need to create at least one other partition to be able to use that space but that is the problem - I have no access to the hard drive to do that (other than Parted Magic). It seems Windows doesn't know what is on the drive as far as partitions and other applications like Disk Defragmenter and Partition Magic won't work with it at all.
And not to just pass on your judgment of Partition Magic (I am sure you are more knowledgeable than I am on this topic) but I have used Partition Magic about 20 times or so in the past to re-size & create partitions without a single issue in Windows XP installations. Granted this was dealing with strictly Windows file systems but that is all I am dealing with here.
Below are some screenshots with a little more information.
The fdisk -l output shows that you have a hard disk of 38913 cylinders and currently use from 1 to 19456 cylinders. That is about 50% of the capacity.
You can use the unallocated space in either
(1) Expand the sda2 which is your "C" drive in Xp as it is a NTFS partition Type 7.
(2) To create a new primary partition sda3 and up to 11 logical partitions by using sda4 as an extended partition.
(3) Any combination of (1) and (2).
For (1) you need to run Parted Magic. Just use the mouse to drag the boundary of sda2 to any size you want.
For (2) You can use any partitioning tool in Linux which is amply provided by Parted Magic. I would recommend the terminal command "cfdisk" as it is one of the best teacher on partitioning. As an example cfdisk does not create an extended partition. If you use it to create the first logical partition then the first one is sda5 and sda3 is automatically used up as an extended partition while sda4 is reserved as a future primary partition. If you create sda3 as a primary partition and the a logical partition then sda4 is used up automatically. This teaches you that sda1 to sda4 are primaries and all logical partitions start with sda5. You will also learn about the partition Type number which is used by all operating systems in a PC but MS Windows never tell you about them!
It is the first time I see Disk Management fails to report a "C" drive that it is using but your partition table looks healthy to me. One thing though when the first time you install the hard disk Xp should detect the serial number of the hard disk has been changed and demand a reboot. The system is healthy after this reboot. Did this happen to you?
My suggestion is try to use and experiment with the new drive but do not mixed with the old hard disk with Xp. I believe it is safe if the old disk is attached as an external disk but as an internal disk it may not be safe. If you need to transfer data use a Linux is the safest.
Partition Magic is good for MS systems and should be OK in your case as you haven't installed any Linux in you hard disk yet. My message is Partition Magic claims to have ability to handle Linux partitions but in reality it doesn't, at least in some of the versions I tried, resulting me rebuild the partition table for a couple of hard disks that have 63 partitions inside.
In you run several Xp on the same disk you need to install a Linux inside and use its boot loader for manipulating the partitions.
You will in due time appreciate Linux is a much better and more robust OS when it comes to partitioning. It is also true that whatever MS and Linux read the same information on the hard disk. Thus if one says its is healthy the other system must do the same.
JReese
01-04-2010, 08:07 AM
It is the first time I see Disk Management fails to report a "C" drive that it is using but your partition table looks healthy to me. One thing though when the first time you install the hard disk Xp should detect the serial number of the hard disk has been changed and demand a reboot. The system is healthy after this reboot. Did this happen to you?
No, this didn't happen and I thought that was strange after reading some of the other comments on here stating that it usually did happen. Windows didn't really act like anything changed. Not even a notification about installing drivers for the newly installed hard drive.
I will do some testing tonight after work with the additional partitioning and maybe even try a second clone to see what happens and then post back later. Thanks again.
JReese
03-12-2010, 10:16 AM
I have to apologize for not posting back regarding my issue. I was working on this off and on over a few weeks when I had the spare time and I just plain forgot to come back and post my results after more testing. Now today I figured I would be using this cloning method on another system over this weekend and a light bulb went off in my head thinking that I never posted back. I hate it when people do that!
In regards to my issue the problems I was experiencing with not being able to perform any management tasks with the hard drive in Windows was indeed a problem with the Windows installation prior to doing the cloning. I have no idea what caused it in the first place (it wasn't my system; it was a past employees) but I didn't notice it prior to doing the cloning and I just assumed it was an issue with the cloning process. After trying this on two other systems and not having any issues at all I went back to inspect the first one and sure enough all of the problems existed in the original installation.
Sorry and thanks again for great information on the cloning process!
JReese
03-12-2010, 12:20 PM
In regards to what I have coming up this weekend with a clone; I am working on an older desktop which has a bad hard drive and I am ultimately looking to clone it to a new hard drive that is on the way. Now looking back on page 5 of this topic I see it mentioned that it will actually transfer the bad blocks of data over as well since it is doing a bit to bit copy so what is my best approach for cloning this old drive to the new one somewhat error free.
Right now I have had GRC SpinRite running on it for 68 hours and it still has 256 hours remaining (it's only 18% complete). But what measures should I take afterwards for best cloning results. Should I look into "ddrescue" as mentioned on page 5 and then run dd with the "noerror" switch?
Any direction would much appreciated. Thanks in advance.
has_te
03-23-2010, 01:45 AM
For saikee...
I've avoided this inquiry in hopes that I might either get this (frikkin') boot on or run out of ideas. Well, that happened.
I've read all 5 of your major instructionals in hope that I might avoid bothering you with yet another uninformed inquiry, but...
So before getting in too deep it's important to know that I will be happy with a simple reference to an applicable post I might have missed.
And to admit that I may have broken a rule or two in the get go.
Box is a 2002 Compaq/HP running XPSp3. Original partitioning on the original included a C: with the usual complement running on ntfs. And a D: (Presario-RP) with restore/repair/renew capabilities on Fat32. Pretty standard I think.
Following what I thought might be an allowable and also operational dd which worked amazingly well (great technique and advice!) and exactly as predicted. It was a lovely dd.
The D: was put on a FAT32 partition in the beginning of the recipient drive and the C: onto the 3rd primary in ntfs. The D: wasn't helping boot (it just wanted to wipe the whole recipient disc) so I took that out but left the FAT32 format as is otherwise.
I worried that the D: was in a first primary (where? windows likes to boot) and the C: was in the third...separated by an extended for the two Linux)
(As you will see from the Parted Magic image I've included or the table from the same source)
The Linux OSs I'm running on the recipient disc (Kubuntu & Mepis) BOTH
list the Windows partition correctly in their respective GRUB menus.
And both will access and manipulate files in the unbootable M$ partition..
all the data seems entirely ok.
I've tried changing the boot flag, getting Mepis to put GRUB at root (which it seems to refuse to do?..I don't know how to 'make' my distros do as you've suggested. I also don't know how to use the Kubuntu 9 to tweak the GRUB location. It no longer has a GRUB application evident in 'system'. Both /boot/grub/menu.lst(s) seem o.k.
Tried several boot codes (mostly just uninformed mimicry from codes I've seen or made up on the fly or) using the SuperGrubDisk and its GRUB command. line (which is also unable to get Windows up).
SGD is otherwise very useful...if I corrupt (usually the Mepis) GRUB.
The original M$ disc is fine..has never been alive with the recipient disc
from the beginning. I just switch the plugs back and forth when I decide to.
Pain.
So this is getting long and I guess my questions are:
-Any sorta easy fix..I'm not so great on scripting or compiling unless I can straight copy it? Like a fresh boot code from the information I've forwarded
-Can I just switch partions around...if its just a matter of the order of things
-Or should I best just get another clean disc and so do - as you've advised in your B: instructional - Whole disc t=>o whole disc. Regardless of the formats thereupon.
-Or any other/home/Owner1/Desktop/PNG image - 839X504 Pixels
thanks very, sorry to be a trouble
P.S. Can't seem to attach the Ksnapshot .png of the partitions screenshot/ Parted Magic.
Will e-mail if it'll help
saikee
03-23-2010, 08:37 AM
You seem to move the Windoze partition around and this is not adisable. Every Xp has a hidden file called boot.ini staying which partition the system was originally installed and it is better not to temper with it unless you know exactly where you are doing.
In your case I would advise a direct disk to disk cloning which is what my thread recommends. In a disk to disk cloning you copy sectors, 512 bytes per sector, of information across. The first sector is the MBR with the partition table inside. Therefore the recipient disk will have exactly the same partition as the source and everything will work once you remove the source and boot the recipient disk alone.
Only after you have satisfied the recipient disk is working perfectly then you should resize the partitions if required. The partition position of the Xp should never be altered as it brings more trouble than benefit. This is also recommended for the utility parition.
I suggest to redo the cloning and get the system transferred in working order first.
has_te
03-23-2010, 02:19 PM
..with my very sincere thanks. And to JUSTLINUX,of course, as well.
"But I had this nice unused partition and it was a really nice dump.
Which seemed to work so nice except for the boot part
And I'm really gonna be working hard to see that
I never have to buy another M$ OS...ever again
[I've bought like...4 or...5(?) an' a fella still can't get no break],
Except that there a couple of applications which are
really bonded with Windoze and...." And so and thusly he mumbly maundered on. And on.
But you know all that.
Very much appreciate all your great research and this very prompt reply.
Been wanting to work into an SSD anyway.
And at my age a big unbreakable drive will last a lifetime ..or more.
cheers
has_te
03-25-2010, 01:54 AM
...having abandoned that fruitless effort.
-IF I had dd'd the C: into a capacious ntfs partition to follow immediately the D: (utility) partition
which I did put first in the recipient disc,
which did clone functionally in that FAT32 pre-formatted partition?
-WOULD that more likely have worked for a good M$ boot?
Since that would have replicated the original order & placement configuration.
There would still have been other stuff in the following partitions.
[I just read your nice reply post more carefully and wondered]
saikee
03-25-2010, 09:35 AM
It depends.
In your case it is not a disk to disk cloning as you "do" have other partitions in the original disk which is not available in the target (or recipient) disk. Thus the first sector or MBR of your two disks will be different.
What I tend to do in such a case would be
(A) Make a back up copies of the partitions that I do not want to clone into another source/disk
(B) Print out a copy of the "fdisk -l" output for the source disk
(C) Delete the unwanted partitions temporary. Using command like fdisk, cfdisk etc
(D) Boot up the source disk to make sure everything is working as expected but do not touch the deleted partition area which should remain unallocated or blank.
(E) Do a disk to disk cloning. Remove the source and boot up the target disk.
(F) When both disks are working as expected boot up the source (without the target attached). Create the deleted partitions in exactly the same positions and sizes, using the previous "fdisk -l" as a guide.
(G) Reboot and check everything back to normal in the source disk.
The deletion of the partitions only alter the partition table and the data has not been destroyed (in fact not a single byte would be touched inside the partitions) if the unallocated space is not formatted. The partition table can be reinstated and all data will be recoverable. This is OK as I have done it loads of time.
I advocate disk to disk cloning because no MS system would not refuse it. The integrity of the partition table is vital and as long as there is no change a MS Windows would accept itself being at a new disk with a different hardware serial number. A hard disk is liable to failure so M$ must allow its systems transferrable if the entire operating system is not changed which would be the case of a disk to disk cloning.
has_te
03-25-2010, 03:40 PM
And I have decided on disk to clean disk on your good advice.
And will not persist on this topic after this final inquiry .
But -- sticking [hypothetical] wonderment Re:
as you "do" have other partitions in the original disk which is not available in the target (or recipient) disk. Thus the first sector or MBR of your two disks will be different.
My source/origin disk has NOTHING on it but the FAT32 D: utility (first)
and the ntfs C: operating main (second).
I proposed:
To first fill a clean first FAT32 partition on the recipient/target disk with the D: contents from the source/origin; as I did before.
To then fill a clean second ntfs partition on the recipient/target disk with the C: contents from the source/origin.
The target/recipient disk DOES/would have some other stuff...but only on latter partitions.
I am dependent on a live/CD Parted Magic for most of these machinations, having had good luck
with that external operator and uncomfortable as generally I am with command line operation
(absent specific, almost cut & paste guidelines), so....'nuff sed.
And ALL of that said...I am done troubling this issue and you, who I am sure have much better things to do.
I wish there were a way to donate to your nice resource but have been politely declined in that.
So --cheers anyway, then and most gratefully, yours...
saikee
03-25-2010, 05:02 PM
has_te,
In your original proposal the target disk has already some partition inside and you are cloning another "c" and "d" drives onto it.
The MS system when booted up in the target will find itself with a different partition table. I am not sure if Xp can tolerate it but Vista and Win7 will throw it out as these systems suspect a virus attack as the partition table has been compromised or has been changed without its knowledge.
Your original scheme is also hard to execute because your source disk once formatted will have at least the first partition claiming the first primary position. The next partition added can only take up the second primary position. A bootloader finds its operating system by the hard disk address and so an operating system installed at the beginning of a hard disk, for being the first partition, will not boot if its position has been shifted downward in the hard disk because the boot loader will load the wrong information by going to the right original address of the hard disk.
has_te
03-29-2010, 04:54 PM
greetings [and I quote], ...Sir Grub Master-Guru
Bit tardy getting back, slow spring here in Montana, like yours
on the Island...I've heard, but outdoor stuff demanded Attn:.
Very much appreciate your last post. Makes perfect sense, as always.
'Bout 'given up anyway...just going to watch the health of the old/fullish disk
and keep out the crap.
But may get up the courage to have another go. Put the D: first and the C: second
as I tentatively proposed. The Linux live CDs seem able to retrieve any boot screw up
I do engineer (which I did in the last effort) and M$ does do a native boot...so got a get-out.
And the amazing data dump facility, of course...and perhaps use "the default block size 512". (I'll let you know if I can get it working.)
But that's for that nonce..Meantime thnx again for all the great instructionals and your
current spate of patient with this latterly unwashed
---From Montana then, Happy Spring to the Isles.
Kavi
04-14-2010, 08:53 PM
First, Hi to all and a big thanks to everyone for submitting the results of their experiments, both successful and not! I see, referring to article #80 that caution is indicated when disk geometries are obviously different. The clue in that case was the number of heads in the old drive = 16, which probably means that it was originally intended to operate in the CHS environment.
Newer drives set up for LBA operation will show 255 heads, so I believe that file descriptors from old to new just don't get you to the same place on the new drive. Perhaps using the methods outlined here would work - I haven't needed to try it out:
http://www.nilbus.com/linux/disk-copy.php
Mostly, the problems crop up with M$ systems as we already know. I also wanted to mention that while most people like to think of a new hard disk as a blank piece of paper, all drives are not created equal. When EIDE came about, all the bad track tables, secret hidden partition information with proprietary security programs now reside in the drive electronics and are not accessible to mortal beings. Manufacturers can put stuff anywhere they please and it will not be detectable because orders must go through the EIDE electronics before they get to the disk. I came across this weirdness while cloning $TEEVO drives, which must see certain data in certain places to operate.
But fortunately, it looks as if 2 new LBA-style drives will accept a simple dd command successfully (look for 255 heads in the fdisk -l output). Thanks again to everyone for the very interesting discussion. It has made me very thoughtful about the whole subject, but especially appreciative for the existence of Linux.
-Kavi
saikee
04-15-2010, 03:35 AM
Kavi,
Welcome to Justlinux!
Your point of some bad track table and other manufacturer information could reside in the electrontic interface of the hard disk is credible and possibly done by many manufacturers. However such information is not accessible by "dd". What Linux can get is exactly what the hard disk manufacturer's declared number of cylinders, heads and sectors. dd and every operating system are not normally able to get into the on-board management information of the hard disk.
If a target disk is of a different manufacturer to the source disk the electronic data can possibly be located physically at different locations between the two hard disks but operational wise they are in the exact numbers of CHS. Thus the data will have to be identical to the operating system, as long as the total number of CHS of the sourced data can be accommodated in the target disk.
If the whole hard disk is cloned both the source and the target will have identical CHS numbers so it doesn't matter what the original arrangement is. In Linux the CHS can be freely altered by the users although I do not recommend messing around with it. If the hard disk is cloned it simply inherits what the source disk has got in the first place.
M$ and other systems can use different geometries than Linux in the partition table and dead spaces can occur. These dead spaces will be the same and faithfully mirrored if the disk is cloned. Again dd will succeed.
Currently I own over 70 hard disks in various format and sizes and have never failed even once in the cloning operation which to me is created for the benefit of the M$ systems. Linux permits migration of its systems and there is no need to clone Linux.
Cloning the hard disk is convenient because the command is so simple that I have taught some teenagers to try it themselves. The difficult part is usually the physical swapping of the hard disks.
Kavi
04-15-2010, 05:50 PM
Thanks for your comments. I have been using Acronis to make a backup of my XP disk for quite some time. The simpler dd method works perfectly also and XP does not complain or ask to be rebooted. (Maybe that problem starts with $Vista). My comments about all hd not being equal had to do with the fact that certain particular drives from certain manufacturers would not boot after a dd clone. I am not skillful enough to know why, but I suspected it must have been related to the need to position data in precise places. In any case, I am a bit wiser now thanks to all the great info in these threads.
Kavi
saikee
04-16-2010, 09:17 AM
Kavi ,
If you have a hard disk that cannot be cloned using dd (this is to say it doesn't boot as the original) I would be interested to know.
The nice thing about dd, which is available in every Unix and Linux system, is that it clones the hard disk sector by sector. As such the type of the operating system or the data in the hard disk is immaterial because it is the raw binary data that is being cloned. Theoretically it is impossible for a cloned copy to behave anything other than its original source.
The dd operation is laughingly simple and is no more than a basic operation with a hard disk. M$ systems do not provide such a simple function and Corporations like Acronis and Norton Ghost make millions on the ignorance of the M$ system users.
has_te
04-18-2010, 12:30 PM
As a simple adendum,
I did find it interesting in looking at the partition table that the old Samsung
source disk in my recent foiled effort had (or claimed to have) 242 heads
While what the much newer WD had is the apparently standard 244 heads.
(Not that any of that had any impact on my own experience.)
-But nice to see this thread is still so active-..
cheers all & best wishes in any doing of the dd
Kavi
04-19-2010, 10:57 AM
Hello,
I'd be happy to supply you with some extra information regarding stubborn drives. But rather than filling the thread with distracting information I would like to PM you directly and let you decide on its value. Currently, the board will not allow me to send a PM, however.
Kavi
has_te
04-19-2010, 11:49 AM
...and thnx
saikee
04-19-2010, 05:54 PM
Kavi,
You can either open a new thread or PM me. If the information is useful to others then a thread can serve as a record.
AleronIves
12-17-2010, 03:06 AM
It seems I am resurrecting a somewhat old thread with my first post. First, thanks saikee for all of the information you've given in both this thread and the original "Using Linux Live CD to clone XP" one. I've gone through all the pages of both topics now.
I am hoping to back up an XP installation to an external USB HDD, but since I already have files on it, I guess I have to use the method of mounting the USB drive and using dd to write an image of the disk. In the original topic, you quoted a post claiming that you could do it this way:
Have you ever tried doing backups to disk images rather than your usual raw disk-to-disk method? Is the chance of failure or having XP "reject" the backup once it has been restored to another HDD higher if you use a disk image? If so, I may just deal with the expense of buying yet another HDD so I can do a raw backup the way you recommend. I know that backing up to an image prevents you from restoring individual files from the backup, but depending on how large the disk image is, I may actually be able to fit two copies of the HDD contents on my backup drive -- a full disk image created in this method, and a plain copy-paste of the files made from within Windows that I can use to restore individual files if necessary. It may be an inefficient use of space, but at least it could save me the expense of buying another drive at present.
Also, I noticed a few comments about USB drives and power -- my drive only connects to a single USB port, not two. Does that increase the chance of write failures during the backup process, or something to that end? I got that impression from reading older posts.
Sorry for all the questions at once, and thanks for any help you can provide.
saikee
12-17-2010, 06:48 PM
AleronIves,
Welcome to Justlinux!
It is true that I favour the disk to disk cloning because you save time in compressing and decompressing the file. In a disk cloning you can use the clone, extract data from it freely or swap it to boot as the original. It is bomb proof because the clone is a mirror image of the source and I have never had a sinle failure with this method.
I have done backups of a hard disk to a file but that was for small capacities. It is only a matter of manipulating the output file into an input file.
If your are cloning the whole disk, as some of your questions refer to it, then cloning the whole disk is a a lot safer. All you need to make sure is the number of cylinders partitioned in the source disk can be accommodated in the target disk. Thus you can clone a 2TB hard disk into a 0.5TB disk if you can temporarily shrink the partitions used below 0.5TB.
The power of cloning the whole disk is when the first sector, which is the MBR, is cloned your target disk must have the same partition table as the source. Therefore you do not need to pre-partition the target disk, any spare will do or a raw disk direct from a new purchase. By default all the data inside the target will be overwritten.
The laptop 2.5" hard disk usually consumes more than 0.5Amp which is the limit of a standard USB port. Thus you need to have a twin head USB cable to pull 1Amp current. I have not come across a 2.5" laptop disk that use over 1 Amp and have seen only small capacity laptop disks with say only 10Gb that consumes less than 0.5 Amp. The consumption is stamped on every hard disk.
The desktop 3.5" hard disk has its own power supply as it need both 12DVC and 5VDC.
AleronIves
12-17-2010, 08:08 PM
Thanks for the reply. If you use dd to dump the entire disk to a file, and then you use dd to dump that file to an unformatted raw disk, wouldn't that yield the same result as using dd to dump the entire disk 1 directly into disk 2, as per your method? Since I don't have a second blank HDD right now, using the intermediate step of dumping to a file would be helpful, but only if it does yield the same end result as your method. I'm not sure why it wouldn't, so I would be grateful for any clarification you could provide. If going to a file does work, were the dd examples that I posted earlier valid for doing that?
saikee
12-18-2010, 04:40 PM
leronIves,
The end result should be the same whether you do it from disk-to-disk or disk-to-file-to-disk.
Back up a large disk is a time consuming exercise and the speed can be optimised using the block size. This is easily done with a hard disk but I am not sure how flexible it is with a file. dd copies one sector of 512 bytes by default unless the user overrides it with "bs=XXXXX" where xxxx is the block size in bytes. The number of records times the block size is the exact size of the data transferred.
I suggest bs=32256 which is 63 sectors x 512 byes per sector. This is one complete track. If the bs parameter is missing the same track is read/write 63 time.
I guess with a file one might have to write down the number of the records and block sizes to keep track of the exact size of the data whereas with a disk the information is automatically inside the partition table.
If you are noe already aware in using dd a hard disk you must destroy everything in the target disk because the first sector of the back up is the MBR making the target disk having the exact partition table as the original. This is to say if you back up a Xp disk from a 80Gb hard disk. The image will be fixed at 80Gb even you restore it on a 2TB hard disk. The balance will be only unallocated empty space with which you can use Gparted to resize the partition after restoration.
If the image goes back to the original hard disk then everything will fit exactly.
I must say I do favour the disk to disk arrangement because in this arrangement I will have the original hard disk untouched. If the cloned image for some reason become defective, say from a corrupt hard disk, I still have the original disk to go back to.
Put the hard disk image on a file is fine but there is no way of telling the image is perfect. If the image does not work but restored onto the original disk then I would lose the entre operating system.
The normal way I woiuld do it is to get hold of a spare disk and clone the hard disk across. I would then remove the original disk for safe keeping and use the clone straight away.
AleronIves
12-21-2010, 03:09 AM
Another reason I want to copy to an image is to be able to compress the free space, but I've found that there aren't that many reputable applications to zero free space on Windows. At this point, SDelete (http://technet.microsoft.com/en-us/sysinternals/bb897443) looks like the best option to me. I can't use Eraser (http://eraser.heidi.ie/), since I only have XP SP2, and it apparently requires SP3. Unless you have experience with a better tool, I guess I'll try SDelete's -c option and hope it does the trick. It's too bad something simple like cat /dev/zero > file doesn't seem to be available, unless someone has ported it to Windows. Though newer Linux versions reportedly can write to NTFS filesystems, it seems safer to try to zero the free space from within Windows.
*edit*
SDelete works.
deanaossenfo
01-12-2011, 11:09 PM
Thank you so much for sharing such wonderful information that was posted here. Thank you for sharing.
saikee
01-13-2011, 01:38 PM
deanaossenfo,
Welcome to Justlinux!
I am merely passing the knowledge the members of this forum have taught me in the past.
HarryB
02-10-2011, 03:58 PM
I'm attempting to clone a drive with a functioning dual boot Win XP/Linux to a larger one using the dd command. However, the cloned Windows OS doesn't work properly, although the Kubuntu that resides on a separate partition on the same drive does.
The cloned drive slowly boots into Windows, but when I log in to Administrator, the task bar is missing, although I can navigate using Explorer because there are shortcuts on the desktop. None of the user accounts are accessible, neither from the login screen (they are there, but when I click on them they won't load) or from within the Control Panel in Administrator mode.
I'm not so much asking how to fix these problems from within Windows as trying to figure out what I'm doing wrong. I've tried the cloning process twice with the same results. I then wrote zeros to the drive and tried again with the same results. I then tried to clone onto a different HDD, but the results were also similar.
FWIW, GParted reports that the source disk has one or more bad sectors, so I used the following command to clone the disk:sudo dd if=/dev/sda of=/dev/sdb conv=noerror,syncIn a couple of cases GParted reported errors on the cloned disk, but in the latest attempt it did not.
Any suggestions would be appreciated.
Harry
saikee
02-10-2011, 05:16 PM
HarryB,
Welcome to Justlinux!
For a Xp the necessary condition is to remove the source when booting up the clone in exactly the same position.
If the source has bad sectors then the bad sectors cannot be read and so the cloned disk can have holes or blank spots in eexactly the same locations as the source. Technically the clone should have no choice but to behave exactly as the source.
Thus my guess is you can clone your Xp but the source is probably doing the same thing. Cloning doesn't get rid of the bad sectors. What you do get is in the clone is that it is healthy and all sectors can be read and written whereas a bad disk will continue to decline until it is unreadable.
Once a disk develops bad sectors the condition can deteriorate very quickly. Thus it pays to limit its spinning time and have it clone ASAP.
HarryB
02-10-2011, 11:12 PM
HarryB,
Welcome to Justlinux!Thank you!
For a Xp the necessary condition is to remove the source when booting up the clone in exactly the same position.I removed the source disk before booting from the target one, which was placed in the same location on the cable as the source.If the source has bad sectors then the bad sectors cannot be read and so the cloned disk can have holes or blank spots in eexactly the same locations as the source. Technically the clone should have no choice but to behave exactly as the source. Thus my guess is you can clone your Xp but the source is probably doing the same thing.The OS on the source disk has been running smoothly for quite some time - I have had no problems with it (other than the occasional ones after automatic updates). The "cloned" OS operates entirely differently, booting into Windows, but misbehaving after it gets to the log-in screen. It is unusable. Cloning doesn't get rid of the bad sectors. What you do get is in the clone is that it is healthy and all sectors can be read and written whereas a bad disk will continue to decline until it is unreadable. Apparently the data in the bad sector(s) is not being used by Windows on the source disk because it is running smoothly.Once a disk develops bad sectors the condition can deteriorate very quickly. Thus it pays to limit its spinning time and have it clone ASAP.I was unaware there were any problems on the source disk until I ran GParted and it reported one or more bad sectors. The reason I decided to clone the disk is because it is running out of free space.
Something I don't understand is going on - and it is repeatable. I have now done 4 or 5 "clonings", each in a slightly different manner, and the results have been similar each time.
saikee
02-12-2011, 12:44 PM
Can you post here the output of sudo fdisk -l, say before and after the cloning?
Technically dd reads from the source disk a number of sectors specified by the user and writes on the target disk. Since the first sector is the MBR so the target disk is "forced" to have the same partition table as the source.
The read/write head must read one sector complete in eachoperation and the information transferred is just the binary pattern. Therefore the target is a mirror image of the source and there cannot be anything else. No filing system is involved. dd only stops when either the number of sector has been exhausted in either the source or the target disk.
Can you repeat the process without the "sync" option?
HarryB
02-13-2011, 11:44 PM
Can you post here the output of sudo fdisk -l, say before and after the cloning?I'm not sure what you mean by "before cloning". I used GParted to delete the partitions on the malfunctioning target disk before attempting to clone again. (I now realize that dd over writes the partition table, so deleting the partitions isn't necessary.)
[snip]Can you repeat the process without the "sync" option?Here is the output of the dd command without the "conv=noerror,sync" option, plus the fdisk result:
ubuntu@ubuntu:~$ sudo dd if=/dev/sda of=/dev/sdb
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 504.96 s, 6.3 MB/s
ubuntu@ubuntu:~$
------------------------------------------
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 13.0 GB, 13030907904 bytes
255 heads, 63 sectors/track, 1584 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6c716c71
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1097 8811621 7 HPFS/NTFS
/dev/sda2 1098 1219 979965 82 Linux swap / Solaris
/dev/sda3 1220 1584 2931862+ 83 Linux
Disk /dev/sdb: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6c716c71
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1097 8811621 7 HPFS/NTFS
/dev/sdb2 1098 1219 979965 82 Linux swap / Solaris
/dev/sdb3 1220 1584 2931862+ 83 Linux
ubuntu@ubuntu:~$And here is the output without the "sync" option plus the fdisk result:
ubuntu@ubuntu:~$ sudo dd if=/dev/sda of=/dev/sdb conv=noerror
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 491.442 s, 6.4 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 514.366 s, 6.2 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 537.297 s, 5.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 560.217 s, 5.7 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 583.125 s, 5.4 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 606.077 s, 5.2 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 628.989 s, 5.0 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.917 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.942 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.942 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.942 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.943 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.943 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.943 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.943 s, 4.9 MB/s
dd: reading `/dev/sda': Input/output error
6190552+0 records in
6190552+0 records out
3169562624 bytes (3.2 GB) copied, 651.943 s, 4.9 MB/s
25450976+0 records in
25450976+0 records out
13030899712 bytes (13 GB) copied, 2755.61 s, 4.7 MB/s
ubuntu@ubuntu:~$
-------------------------------------------
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 13.0 GB, 13030907904 bytes
255 heads, 63 sectors/track, 1584 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6c716c71
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1097 8811621 7 HPFS/NTFS
/dev/sda2 1098 1219 979965 82 Linux swap / Solaris
/dev/sda3 1220 1584 2931862+ 83 Linux
Disk /dev/sdb: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6c716c71
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1097 8811621 7 HPFS/NTFS
/dev/sdb2 1098 1219 979965 82 Linux swap / Solaris
/dev/sdb3 1220 1584 2931862+ 83 Linux
ubuntu@ubuntu:~$Both of these methods produced the same results: when I tried to mount the Windows partition on the target disk I received an error message, the first part of which read: $MFT must be non-resident. Failed to load $MFT: Input/output error Failed to mount '/dev/sdb1': Input/output error NTFS is either inconsistent, or you have hardware faults ...
I have no idea if any of this is helpful, but I will note that I have attempted to clone the source disk using HDClone, a free (many features disabled) Windows program onto a different drive. Although I haven't yet had the chance to really test it, I have reason to think that clone was successful.
saikee
02-14-2011, 01:48 PM
Your cloning with dd has failed in both cases.
Your source is 13Gb large and the target is 41.1Gb so a standard cloning will stop once the source is exhausted in reading.
However dd reported only
6190552+0 records in
6190552+0 records out
were processed. As the block was not specified so the default of 1 record= 512 byte would be used. 512 bytes times 6190552 is 3.17Gb. Therefore only part of the source was successfully cloned and the rest was missing.
Although the partition table is identical in both disks that is only because it came out from the first 512 bytes of sda and sdb.
My guess is you are using only partly cloned disk with the remaining 13-3.17=9.83Gb same as before. Thus that explains the funny behaviour of the Xp.
If you destroy the partition table you only clear the 64 bytes in the first 512 bytes (called the MBR). The information of the partition interior is untouched! Therefore even the target was partly cloned with 3.1Gb its remainder could still be usable.
dd in your case has clearly stated that there was an input/output error in sda causing it to terminates itself prematurely.
Your sda hard disk has deteriorated to the extent that dd cannot read the entire disk in each attempt.
HarryB
02-15-2011, 10:18 PM
Your cloning with dd has failed in both cases.
Your source is 13Gb large and the target is 41.1Gb so a standard cloning will stop once the source is exhausted in reading.
However dd reported only
6190552+0 records in
6190552+0 records out
were processed. As the block was not specified so the default of 1 record= 512 byte would be used. 512 bytes times 6190552 is 3.17Gb. Therefore only part of the source was successfully cloned and the rest was missing.
Although the partition table is identical in both disks that is only because it came out from the first 512 bytes of sda and sdb.
My guess is you are using only partly cloned disk with the remaining 13-3.17=9.83Gb same as before. Thus that explains the funny behaviour of the Xp.That never occurred to me, and it certainly make sense.
[snip]Your sda hard disk has deteriorated to the extent that dd cannot read the entire disk in each attempt.Although I still don't see any evidence that the source disk is going downhill (because Windows still runs Ok), I will take your word for it and have reinstalled Windows on a different HDD.
Thank you so much for taking the time to help me get a better grasp on what was going on. I still don't completely understand it and may someday tinker with dd again in order to gain a better understanding.
saikee
02-16-2011, 05:10 AM
the command dd is actually very simple as it works with the hard disk directly by doing a sector by sector reading from a source and writing on a target disk.
It repeatedly claimed read/write error with sda after executing 3.1Gb and "stopped". Thus dd was unable to read the sda after this point.
Your Xp is likely to have been installed at the front end of the disk and could possibly work up to a certain point with only 3.1Gb.
You could mount the Xp in a Linux and try to extract as much information out as possible. It is likely the files beyond the first 3.1Gb area may report difficulties if they are accessed. Remember the problem here lies with the hard disk and Linux has a better ability in getting defective information out of it. The problem with Xp is that it only take one corrupted system file to stop it from booting up.
biomecanoid
05-27-2011, 05:36 AM
The whole cloning process with dd works well, But what can i do in case i need to read/write/clone the old hard disk serial of every partition ( cause from what i know with every new format the partition gets a new serial ) to the new hard-disk ? what is the process for that ?
saikee
05-27-2011, 09:22 AM
biomecanoid,
Welcome to Justlinux!
Yes nowadays each partition is given a unique idenfication. I believe the protocol is an agreement between all the major operating systems and for the Linux it is call UUID whereas for the MS system it is called GUID. The same number is used in both systems except it is called by a different name. It is up to the operating system to generate it.
This number is used by some boot loaders and so it is cruisal that the boot loader can locate the correct partition to boot.
As dd duplicates faithfully each hard disk so you will end up with two hard disks having two set of identical UUID or GUID. This does not cause confusion as the system has already been booted and the boot loader is not in charge. Only if you reboot the system then the confusion would materialise.
In a correct procedure after cloning either the target or the source should be removed as there is no need to have both disks to confuse the operating system.
If by mistake both disks are present then the boot loader would simply boot up the first one it finds and this seems to be the case for both Linux and MS systems. The disk order dictates which disk get booted first.
However a MS Windows system, like Xp, is more interfering and it could de-activate the activation code resulting both copies of the MS Windows unable to run in a belief the system has been attacked. MS Windows do not know how to handle such a situation and so they may change the system files as a way to protect themselves. Linux doesn't bother the duplication.
In conclusion you don't need to do anything. Just remove one of the disk.
Remember the target is a 100% clone and works exactly as the source disk. I often put away the source for safe keeping as the backup and start using the clone immediately.
jhecht
06-06-2011, 11:30 AM
Migrating Win XP to a different computer...
First, let me express my profound thanks to Saikee for his expertise and tireless dedication to helping fellow Linuxians! :) I'm a pro computer tech, and have used Puppy Linux and other distros for years to help deal with balky Window$ computers. But I work more through the GUI, and am less skilled with the commandline.
This description is for my attempt to migrate my (very complex) Win XP computer setup from an older machine to a newer one.
The old computer is a Dell Dimension 4400 and the newer one is a Dell Optiplex 745. The problem is that the old 'puter has a gazillion programs and special features installed. It would take weeks of work to reload everything.
While I have a good backup, (Acronis disk image), I want to clone the entire Windows setup to a new(er) computer, both for safety, and because the older hardware is getting a bit tired.
The older 'puter has only PATA drive capability, and the new one only handles SATA drives.
Luckily, I have an IDE/SATA to USB adaptor that I can use to hook up the new drive to the older computer.
I've already tested the new drive and its cables by doing a basic install of Window$ to it
from CD. The test install booted and worked fine, but whe I used Acronis True Image to
restore an image from the old computer to the new drive, it would not boot up, even though I could see the files under a Linux live CD boot, and checked to make sure the boot flag was set to 'on' on the new drive, using Gparted from the Puppy live CD. Windows starts to boot, and falls back to the all-too-familiar prompt that "Windows failed to start properly, do you want to boot in safe mode, safe mode w/networking..."
I also tried booting from an XP CD, using the recovery console, and trying 'fixmbr' and 'fixboot' commands - all with no joy. :(
Since Acronis wants $80-some dollars for the latest version, and the 'plus-pack' to allow
restores to dissimilar hardware, I want to try using the 'dd' command to make the drive clone.
My first question is - can I use Puppy Linux 5.25 to do this, or is there some difference in the Gparted packages included with it that would make it better to use the Gparted live CD?
I've successfully used the Puppy-included version of Gparted for other operations. Puppy 5.25 is based on a recent Linux kernel - I'm having a little difficulty finding which version, but I think it's in the neighborhood of 2.6.38.x.
My old hard drive has 3 partitions on it - Puppy sees them as sda, rather then hda, so they are sda1, sda2, and sda3. I also have a storage drive in the old computer that Puppy sees as sdb1. When I hook up the drive I want to clone onto, Puppy will see it as sdc1.
So, if I understand correctly, the 'dd' clone process should be very simple. The steps would be as follows:
1 - Hook up the new (SATA) drive to my old computer, using my IDE/SATA to USB adaptor.
2 - Boot the old computer from a Puppy Linux 5.25 CD. Likely any modern distro would work, but Puppy is my fave!
3 - Open a console window and type: dd if=/dev/sda of=/dev/sdc bs=32256.
4 - Allow the copy process to complete.
5 - Close the console window.
6 - Open Gparted and use it to resize the partitions. My old hard drive is 80 GB, and the new
one is 500 GB. If I erase all the partitions on the new (SATA) dive before copyng, I should
have a lot of (unformatted) space after the three copied partitions. If I understand
correctly, Gparted can 'slide' the three partions around and resize them, so I wind up with a bootable drive that has three partitions of (roughly) 160 GB each - which is my goal. Is there any advantage to formatting the new drive first? All the partitions I want to copy are NTFS. I doubt it would make any difference, but wanted to check.
7 - Reinstall the new (SATA) drive in the new computer, and (God willing) boot up happily. :)
Do I have it right? Thanks in advance for your help! And may I recommend Puppy Linux to all the users here? It's a GREAT distro - blindingly fast, tons of apps available, and great support from the Puppy forums. I would normally have posted my query there, but I was so blown away by Saikee's commandline skill that I wanted to pick his brains (grin).
In return, I'm an ex-audio engineer/studio builder,so if Saikee (or any of you) have audio
questions, feel free to email me at jhecht@ix.netcom.com. And please check out my book on audio wiring at http://www.amazon.com/Audio-Wiring-Guide-popular-connectors/dp/0240520068
More info about me on my home website - http://www.zenarrow.com.
saikee
06-06-2011, 08:37 PM
jhecht,
Welcome to Justlinux!
Yes you got it right.
Here are a few pointers which may of interest to you.
There is no need to format or partition the clone. When the dd operation starts the sector cloned will be the MBR and therefore your target disk will immediately has the exact partition table as the 80Gb source disk. Thus all previous formatting and partitioning work bring no benefit. I often start with a raw disk immediately after the purchase.
You can use Puppy as it has dd command and allow you log in as root.
As I mentioned earlier your 500Gb disk will have only the first 80Gb filled and the rest is unallocated space.
You can move a data partition, one without a bootable operating system, freely to the left or to the right but not one with a system inside like sda1 which is a traditional place for a MS Windows Xp.
For a partition with Xp you can only expand the right hand side boundary. The left hand side has the boot sector its address is hard coded into the boot loader. Thus sda1 should not be moved but can be expanded unilaterally to the right if unllocated space has been created. If you do need to move a bootable partition you need to repair the boot loader and that is not a big deal.
The first time you boot the 500Gb clone you should have the 80Gb source disk disconnected so that the clone will take over the hardware position of the source disk.
Also when the clone is booted for the first time Xp will immediately knows the hard disk serial number no longer matches the record. It will demand an immediate reboot. After the reboot it will work normally forever. There is no need to reactivate.
The cloning should work perfectly but if it doesn't you can do it again. The most important bit of the whole process to is known sda is the disk to be read as this is the disk that will not get changed. If you are not sure do a
fdisk -l before the dd command. The sda1, sda2 and sda3 should have type 7 ID for NTFS filing system and the number of cylinders of the 80Gb disk is about 1/6 of the 500Gb disk which should be sdc as you have identified.
Gparted does Live CD which is a software specialised in partitioning. You will find its programs like fdisk, cfdisk etc most up to date. Other than that you can do everything with the Puppy Linux.
Lastly there is indicator for the progress of dd so you have to estimate the time it take. For internal hard disk dd does between 20 to 70Mb/s depending on the disk type and CPU. If one of the disk is via a USB2 then the transfer rate can drop to 10Mb/s.
I think I have done IDE to Sata disk before and so your 500Gb Sata should boot first time if the IDE disk is absent. Never put two exact copies of Xp together as it can confuse the MS operating system which can cancel the activation. The only time you can check them together is booting into a Linux.
One more point: I am not familiar with Dell's various models but my tutorial is for migrating the operating system from hard disk to hard disk and not to a different computer. Xp is hard ware dependent, as it needs different drivers for a different machine, and cannot be migrated from PC to PC unless the hardware are identical (same CPU, memory, Graphic card, network card etc). Migrating an operating system from PC to PC in general never work for the M$ systems (it is also illegal) but possible with desktop-based Linux and not server-based Linux. If you want to use the Xp license on the new PC you can do so by claiming the old PC no longer serviceable, removing from in the old PC and doing a new installation in the new PC.
jhecht
06-08-2011, 05:07 PM
Saikee> Yes you got it right. Here are a few pointers which may of interest to you.
JH> High praise from a Grandmaster of the Linux commandline (grin).
_______
Saikee> There is no need to format or partition the clone...
JH> I had thought not from your earlier writing.
_______
Saikee> You can use Puppy as it has dd command and allow you log in as root.
JH> That's one of the things I like about Puppy - you ARE root by default. Saves time.
_______
Saikee> As I mentioned earlier your 500Gb disk will have only the first 80Gb filled and the rest is unallocated space.
JH> No problem - I've tested Gparted, and think I can do what I want - to slide the two NON-boot paartitions to the 'right' (in Gparted) then resize them to leave blank space after sda1. Since sda1 is the XP boot partition, I have to leave its start point anchored, but can expand it, if I have blank space on the 'right' in Gparted. Is that correct?
_______
Saikee> You can move a data partition, one without a bootable operating system, freely to the left or to the right but not one with a system inside like sda1 which is a traditional place for a MS Windows Xp.
JH> Let me try a little ASCII artwork here:
what the clone will start out like
|<:::::sda1:::::>|<:::::sda2:::::>|<:::::sda3:::::>|<::::unformatted::::>|
what I want to do
|<:::::::::sda1:::::::::>|<::::::::::sda2::::::::::>|<:::::::::sda3::::::::>|
It seems like this should work - is that true?
_______
Saikee> For a partition with Xp you can only expand the right hand side boundary. The left hand side has the boot sector its address is hard coded into the boot loader. Thus sda1 should not be moved but can be expanded unilaterally to the right if unllocated space has been created.
JH> I think you're saying I can do what I want to do. :D
_______
Saikee> The first time you boot the 500Gb clone you should have the 80Gb source disk disconnected so that the clone will take over the hardware position of the source disk.
JH> But I will never boot the clone on the older (parent) computer. I can't, as the new drive is SATA, and the old computer is PATA (IDE) only. Instead, I'll disconnect the IDE/SATA to USB adapter, and re-install the SATA drive in the newer computer where I want to use it.
_______
Saikee> The most important bit of the whole process to is known sda is the disk to be read as this is the disk that will not get changed. If you are not sure do a
Code:
fdisk -l
before the dd command. The sda1, sda2 and sda3 should have type 7 ID for NTFS filing system and the number of cylinders of the 80Gb disk is about 1/6 of the 500Gb disk which should be sdc as you have identified.
JH> Um, yes - since the 'dd' commmand has NO safety precautions, one could wipe the wrong drive in a heartbeat if you got the syntax wrong! Powerful tools are frequently dangerous... ;) With Puppy, any active drives are displayed at bootup with their Linux drive designations. The only oddity is that hda drives display as sda even though they are not SCSI drives. So a newbie could click on a drive to mount/open it, and see what files are there. Your commandline code gives other info. Good to know both and enjoy options. :)
_______
Saikee> Gparted does Live CD which is a software specialised in partitioning. You will find its programs like fdisk, cfdisk etc most up to date. Other than that you can do everything with the Puppy Linux.
JH> Interesting - I know Gparted as a proggie but was not aware of the live CD option. Does it have any disk tools that are not included in modern Linux distros?
_______
Saikee> Lastly there is indicator for the progress of dd so you have to estimate the time it take...
JH> Here I think you meant "...there is NO indicator for the progress..." from your other postings in this thread. Might it be possible to create an option for the 'dd' command to 'show progress'? That's a question all for you 'nix programmers.
_______
Saikee> I think I have done IDE to Sata disk before and so your 500Gb Sata should boot first time if the IDE disk is absent. Never put two exact copies of Xp together as it can confuse the MS operating system which can cancel the activation. The only time you can check them together is booting into a Linux.
JH> Understood - but I never expect to have both drives hooked up at once, except under Linux.
_______
Saikee> One more point: I am not familiar with Dell's various models but my tutorial is for migrating the operating system from hard disk to hard disk and not to a different computer.
JH> TRUE - but I think MANY people will want to do what I want; to keep an existing XP install, and migrate it, along with ALL the installed programs and features, over to newer hardware. Yes, there will be some drivers to replace/add - but that part's easy - see the next section.
_______
Saikee> Xp is hard ware dependent, as it needs different drivers for a different machine, and cannot be migrated from PC to PC unless the hardware are identical (same CPU, memory, Graphic card, network card etc).
JH> Totally true - but very easy to fix. Dell has all the drivers I need for the newer computer hardware online. I have already downloaded them and have them ready to install. In fact, I already tried installing them, when I set up a generic XP boot on the new computer to test all the hardware. They went in fine - so drivers? No problemo! :)
_______
Saikee> Migrating an operating system from PC to PC in general never work for the M$ systems (it is also illegal) but possible with desktop-based Linux and not server-based Linux.
JH> Acronis True Image BackUp runs on IsoLinux - a distro I don't know. But Acronis can multi-cast from a server, AFAIK. You just have to tell it where the new drivers are located and Acronis TIB will 'slipstream the drivers into the multicast. Ghost 4 Linux (another live CD) can also multi-cast. Legal? I want to take one (1) complete XP install and clone it to newer hardware.
Once I am confident that the new setup is OK, I'll pull the drive from the old computer, and make it into a happy Puppy Linux computer. I own both computers, the COA stickers, and one set of Dell install CDs. If Bill Gates and the Piracy Police don't like my moving 1 'seat' from computer A to computer B, they can kiss my Linux-lovin' drainpipe!
_______
If you want to use the Xp license on the new PC you can do so by claiming the old PC no longer serviceable, removing from in the old PC and doing a new installation in the new PC.
JH> I'm more than happy to $#@! at M$ $upport, but let's wait and see if I have to. However, in my vocabulary, a Windows 'install' would typically be a 'clean' install - which is exactly the thing I'm trying to avoid by using the 'dd' command. I don't just want to copy Windows - I want to copy a very complex setup with dozens of installed programs, macros & hotkeys up the wazoo!
Thanks again for your help Saikee! :) Maybe you should split off this thread and re-title it - "Migrating from old to new computer" or some such title? That way people who want to do this particular process will know where to look.
saikee
06-08-2011, 06:56 PM
jhecht,
From my experience you should end up with a brick wall unless the two PC are so much similar. Xp protects itself by recording each hardware by a point system. If the changes are significant and breach the pre-set threshold the XP will lock itself up. Let us know how you get on.
Yes I meant dd gives no indicator.
hda to hde were assigned to IDE hard disks but later kernels now call all SCSI/IDE/Sata/USB flash drives sda, sdb, sdc etc. The changeover was done with kernel 2.6.20 since Sep 07. Only older kernel or servers distros would hang on the hda/hdb/hdc/hde device names for compatibility reasons.
I confirm your expansions of sda1, sda2 and sda3 would be acceptable as sda1 is anchored at the left side.
Gparted and Parted Magic do Live CD. They are just like a normal Linux distro but have the best or more complete collection of partitioning tools.
Lastly if you are not already aware M$ has a back door installed in Xp so that whenever you log into the Internet your Xp will report to M$ with all your registries in the PC. If your Xp locks you out you can call M$ and they can unlock it via the Internet. Therefore you should never run the same license on more than one computer. If it works initially it can still suddenly drop dead one day leaving you to think it is a cyber attack. It is possible that M$ do not honour the correct updates if they know the copies are illegitimate making them vulnerable to attacks. If you run only one license you are protected by M$ with all its updates. Without the correct updates Xp is as good as death!
justlinux.com
Copyright Internet.com Inc. All Rights Reserved.