Click to See Complete Forum and Search --> : How to migrate XP, Vista, Linux, BSD and Solaris to a bigger hard disk
saikee 05-18-2007, 07:17 AM ----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 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 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.
Here's a link to the full walkthrough:
http://geekswithblogs.net/lorint/archive/2006/12/07/100596.aspx
saikee 07-14-2007, 07:43 AM asmith,
The link you posted is interesting.
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:
dd if=/dev/sda of=/dev/hda bs=32768 count=610470 <enter>
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: /etc/fstab
# /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
UUID=89e97a5c-4907-46f4-80eb-376f871c1d49 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
=====================
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
## ## End Default Options ##
title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=7a70ca0f-767b-4efb-8d00-7b5c800098d4 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet
title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=7a70ca0f-767b-4efb-8d00-7b5c800098d4 ro single
initrd /boot/initrd.img-2.6.22-14-generic
title Ubuntu 7.10, kernel 2.6.20-16-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=7a70ca0f-767b-4efb-8d00-7b5c800098d4 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
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 /m |