Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
01-04-2009, 12:53 AM
|
#16
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
A Windows ME installation will probably have just one partition and use Fat32. It won't recognize an NTFS partition.
It should be easy to clone the drive, and then resize the copy if the drive size is larger. Any Linux live distro should have gparted or a similar program that can do it easily. Next, make the new drive the master, so it is the new C: drive. Windows won't complain then. Windows will probably designate the old drive D:. The most likely conflict is if D: was hardwired in some configuration as the CDROM drive.
|
|
|
01-04-2009, 01:02 AM
|
#17
|
Member
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609
Original Poster
Rep:
|
Quote:
Originally Posted by jschiwal
A Windows ME installation will probably have just one partition and use Fat32. It won't recognize an NTFS partition.
It should be easy to clone the drive, and then resize the copy if the drive size is larger. Any Linux live distro should have gparted or a similar program that can do it easily. Next, make the new drive the master, so it is the new C: drive. Windows won't complain then. Windows will probably designate the old drive D:. The most likely conflict is if D: was hardwired in some configuration as the CDROM drive.
|
Thank you for the response.
I am not sure when ms went from fat to ntfs. I will find out as soon as I get my hands on the computer.
If all goes well, I think it might be a good idea just to pack the old drive away once the drive is cloned.
|
|
|
01-04-2009, 01:12 AM
|
#18
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,340
|
Quote:
Originally Posted by okos
If it doesn't work, no harm no fowl. I can always wipe then new disk clean again and try something else.
|
And this is absolutely the right attitude to adopt.
Good luck with it.
|
|
|
01-04-2009, 04:04 AM
|
#19
|
Senior Member
Registered: Nov 2004
Distribution: Mint, MX, antiX, SystemRescue
Posts: 2,337
|
Quote:
Originally Posted by okos
no harm no fowl
|
Yeah, I've been sick of turkey ever since Thanksgiving too!
Yes, go ahead and try the cloning. As you said ... if it doesn't work, you're no worse off than before. And you will have gained experience trying, even if unsuccessful. Good luck!
|
|
|
01-04-2009, 05:37 PM
|
#20
|
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 4,137
|
Windows Me -> NT/XP is the breaking point to go from Fat32 to NTFS. Windows 95, 98, ME were Fat32. And it depends on the version of Windows 95. Earlier ones were Fat16. And stuff on floppies is Fat12. And other oddities the further you go back.
Just use G4L. Or dd if you keep the same partition size and partition number. I think the older ones have anti-linux measures in place. Like detecting that the partition or filesystem wasn't generated by windows. And in the case of ME, an emulated DOS layer which broke loadlin from working as a boot option. There probably are some fixed files that need a certain location to prevent your from doing a file for file copy. Recalling the olden days when msdos.sys, io.sys, and command.com had to be the first files that made it to disk. And many other things that are all but worthless things to know in todays marketplace.
If there's a lot of garbage on their windows install, they can use a USB docking station and an external drive (or flash drive, or usb hdd enclosure) to offload the garbage. Cheap and functional these days. Outside of 1,000 installed games that hog drive space, you should be able to remove all but 100MB or so of drive usage by various non-OS things. At least for those earlier versions of windows. Back when you could only format a partition to 2GB (Fat16). Although newer version of windows limits you to 32GB for Fat type partitions. Even though your USB HDD probably shipped with an 80GB Fat filesystem on it.
Another option would be to run linux. If their old accounting software used standard libs and such it might run with wine. Or crossover office, or cedega, or whatever variant there of applies. Or vmware, or ....... Not that many of them are well suited for parental units with minimal computer skills. Just some options. Keep the originals (images or otherwise) if you can. It'll save you a lot of headache in case of failure. USB docking station plus 500GB Sata Drives gives me nearly 2TB of archival space for under $400.
|
|
|
01-05-2009, 12:07 AM
|
#21
|
Member
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609
Original Poster
Rep:
|
I will be going to my parents later this week.
I appreciate the input.
Shadow, this brings up one question, I was planning on using dd to transfer the files then expand the partition once everything works. How large of a partition can I create with win me and fat 32?
[EDIT]
never mind, I found the answer from microsoft support
Quote:
FAT32: This file system supports drives that are up to 2 terabytes in size and stores files on smaller sections of the hard disk than the FAT16 file system does. This results in more free space on the hard disk. The FAT32 file system does not support drives that are smaller than 512 MB.For additional information about the FAT32 file system, click the article number below to view the article in the Microsoft Knowledge Base:
|
[/EDIT]
Last edited by okos; 01-05-2009 at 12:12 AM.
|
|
|
01-08-2009, 11:52 PM
|
#22
|
Member
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609
Original Poster
Rep:
|
Follow up
I was able to successfully copy (clone) the windows ME, programs, and data from a 20gb formatted in fat32 to a 500gb hdd.
I first tried clonezilla but it would not work. I tried three times and froze each time after completing about 64% of the job.
I then followed this link as suggested in an earlier post with great success.
http://www.nilbus.com/linux/disk-copy.php
I used knoppix 5.1 to do the work with only one snag. The computer had limited memory and would have been better to use an older version of knoppix. I had trouble getting knoppix to run with limited memory and had to temporarily move put the old and new hdds in a newer computer in order to clone the drive.
In case the link dies, I thought I would copy the info here. I did not see anything about copywrite issues. It was written 20 Mar 2005 by Ed Anderson. Updated 13 Oct 2005.
Code:
Copying Windows to a new drive, using linux - How-to/Guide
Written 20 Mar 2005 by Ed Anderson. Updated 13 Oct 2005 (Suggest setting DMA before copying partitions)
Overview
This guide will show you how to copy an existing installation of Windows (or any other OS) from one drive to another - as long as the destination drive is the same size or larger.
This is a free and relatively easy method that will create a clone of your current hard disk, without having to buy any third party software.
Note: This may or may not work with NTFS because of sectors that windows may write to outside the partition table. I haven't verified this either way. This being said, please feel free to try this howto using NTFS, and tell me how it works. There's no reason not to experiment when copying to an empty drive. :)
1. Gathering tools
2. Physical Installation
3. Preparing new partition table
4. Copy the MBR
5. Copy the Partition
6. Resizing the Partition
7. FAQ
Gathering Tools
For this project, you will need a Linux Live CD that has dd, fdisk, parted/qtparted, and ntfsresize (for NTFS partitions).
Knoppix is a Live CD that has everything you'll need. Burn the contents of the ISO to CD to boot from later.
Physical Installation
Install both hard drives in your computer. In this guide, I will use the following disk setup as an example:
/dev/hda (Primary Master) - New, empty 80G drive
/dev/hdb (Primary Slave) - Old 10G drive with all data on one NTFS partition (/dev/hdb1)
Your disk setup can vary, but in this guide, I will refer to the new drive as /dev/hda, and the old as /dev/hdb. Use device names according to your own setup.
If you're not familiar with this naming scheme for disks/partitions, read the Linux Partition HOWTO.
To sum it up, IDE disks are referred to by /dev/hdX where X is corresponds to the disk order (a for the first disk, d for the last). Partitions are referred to as /dev/hdXY where Y is the partiton number. (eg. /dev/hdc2 is the 3rd disk, 2nd partition) SCSI disks are the same, but sdX instead of hdX.
Preparing new partition table
Before you start, you may want to run scandisk on your drive to verify that there are no errors on the disk.
Boot from the Live CD. Press enter at the boot: prompt.
Open a new terminal as root. In knoppix 3.7, click on the Penguin icon, and click Root Shell.
View the partition table for the old disk:
# fdisk -l -u /dev/hdb
Disk /dev/hdb: 10.2 GB, 10240000000 bytes
255 heads, 63 sectors/track, 1244 cylinders, total 20000000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 63 19968794 9984366 7 HPFS/NTFS
Note that I used the -u option on fdisk. This displays the start and end units in sectors, rather than cylinders, since the cylinder size varies from disk to disk.
Record the Start and End positions, and the Id for the existing partition.
Now run fdisk on the new disk.
# fdisk /dev/hda
Device contains neither a valid DOS partition table, nor Sun, SGI or
OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 158730.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by
w(rite)
Command (m for help):
When you run fdisk on an emptry drive, it may tell you that there is no partition table, or that the disk is large. You may safely ignore these warnings.
Print the current partition table to verify that there are no partitions on the disk.
Command (m for help): p
Disk /dev/hda: 81.9 GB, 81920000000 bytes
16 heads, 63 sectors/track, 158730 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
If there are partitions listed, and you were expecting none, make sure you ran fdisk on the correct device. You should delete the existing partitions on the new disk, only if you know that the data is not needed.
Create an identical partition, using the Start and End positions from the other disk. Be sure to change the units to Sectors.
Command (m for help): u
Changing display/entry units to sectors
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-159999999, default 63): 63
Last sector or +size or +sizeM or +sizeK (63-159999999, default 159999999): 19968794
Command (m for help): p
Disk /dev/hda: 81.9 GB, 81920000000 bytes
16 heads, 63 sectors/track, 158730 cylinders, total 160000000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 63 19968794 9984366 83 Linux
Before we're done, we must set the Boot flag and System Id. Use the same Id that was listed on your old partition table.
Command (m for help): a
Partition number (1-4): 1
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)
Command (m for help): p
Disk /dev/hda: 81.9 GB, 81920000000 bytes
16 heads, 63 sectors/track, 158730 cylinders, total 160000000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 63 19968794 9984366 7 HPFS/NTFS
The partition should now look identical to when you ran fdisk -l -u /dev/hdb
Now we must write the changes to disk.
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Copy the MBR
For the new disk to boot, we must copy the boot code from the Master Boot Record (MBR) to the new disk.
The MBR is on the first sector of the disk, and is split into three parts:
* Boot Code (446 bytes)
* Partition Table (64 bytes)
* Boot Code Signature = 55aa (2 bytes)
We only want to copy the boot code - the first 446 bytes. We do this with dd:
# dd if=/dev/hdb of=/dev/hda bs=446 count=1
1+0 records in
1+0 records out
446 bytes transferred in 0.026312 seconds (16950 bytes/sec)
Copying the Partition
Optional: We should try to enable DMA on both disks, to increase the transfer speed.
# hdparm -d 1 /dev/hda
/dev/hda:
setting using_dma to 1 (on)
using_dma = 1 (on)
# hdparm -d 1 /dev/hdb
/dev/hdb:
setting using_dma to 1 (on)
using_dma = 1 (on)
The next task is to copy the filesystem from one disk to the other. We'll do this with dd as well. This time, instead of working with the disk device (hda, hdb), we'll be using the partition device (hda1, hdb1).
# dd if=/dev/hdb1 of=/dev/hda1 bs=4096
2496092+0 records in
2496092+0 records out
10223990784 bytes transferred in 355.312 seconds (28774684 bytes/sec)
This may take a long time, especially if the partition size is large. You can verify that it's doing "something" by running top in another terminal.
Resizing the Partition
Next, we resize the partition to fill the disk. You should only do this section if you are copying to a larger disk, and don't want to leave unpartitioned space.
By far, the easist way is with qtparted. It is a graphical front-end to parted and ntfsresize. If you are using a Live CD without a GUI, you'll have to use parted or ntfsresize.
Method 1: qtparted
This method should work with most filesystems, including NTFS and FAT32.
1. Start qtparted from the command line.
2. Select the new disk (/dev/hda)
3. Right click on the partition to rezise, and click Resize.
4. Change "Free Space After" to 0, and press OK. The partition should now span the disk.
5. Commit the changes to disk using the the Commit option in the File menu.
After the commit operation finishes with your disk, you can reboot onto your new hard drive, and everything should work. Since you resized your partition, be sure to run scandisk to remove any errors in the newly created filesystem.
Method 2: ntfsresize
(no examples yet)
Method 3: parted
If you don't have a GUI, you can use parted to resize almost any non-ntfs partition. In this example, I'll resize a FAT32 partition to fill the drive.
Run parted. You may safely ignore errors about the partition alignment.
# parted /dev/hda
GNU Parted 1.6.9
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
Using /dev/hda
Warning: Unable to align partition properly. This probably means that another
partitioning tool generated an incorrect partition table, because it didn't hav
e
the correct BIOS geometry. It is safe to ignore,but ignoring may cause
(fixable) problems with some boot loaders.
Ignore/Cancel? i
Display the current partition table (p), and resize the partition to the size of the drive.
(parted) p
Disk geometry for /dev/hda: 0.000-78125.000 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 9750.234 primary fat32 boot, lba
(parted) resize
Partition number? 1
Start? [0.0308]? 0.0308
End? [9750.2339]? 78125.000
(parted)
This may take some time, depending on the size of the partition. When it's done, you can reboot into windows. Since you modified the partition, be sure to run scandisk to remove any errors in the newly created filesystem.
FAQ
* Why can't I just copy the files, instead of the whole partition?
I haven't experimented doing this on Linux. You can't if you have NTFS partitions, since linux can't write files on an NTFS partition.
On FAT32, I would be afraid of losing windows file attributes, missing files, and messing up file order. The advantage would be that no unused space on the filesystem would need to be transferred. Someone please let me know if you've tried, and I'll update this page.
If I were to try this method on a FAT32 disk, I would create a large partition on /dev/hda, and run
# mkfs.vfat -F 32 /dev/hda1
mkfs.vfat 2.10 (22 Sep 2003)
# mkdir old new
# mount /dev/hdb1 /mnt/old
# mount /dev/hda1 /mnt/new
# cd old
# find | cpio -pdV ../new
* Can't I create the MBR with the DOS fdisk /mbr, instead of dd?
Yes, but that would require making a boot disk, or something else that requires more effort than dd. :) Since we're in the Linux environment, it's easier to use dd.
* I have a suggestion or need some help. Can I contact you?
Yes. You can find me on IRC on irc.freenode.net #Nilbus, or contact me at nilbus AT nilbus DOT com
Post this page to: del.icio.us Yahoo! MyWeb Digg reddit Furl Blinklist Spurl
Comments
Hi,
Thanks a lot for this howto, it perfectly answered my needs (creating a ghost of a bootable NTFS windows partition). I found a typo in the howto. The dd command line to copy the MBR copies the empty hard drive's MBR to the old hard drive. Inverting hda and hdb in this type of command can be quite problematic...
Thanks again,
Matthieu
#1 - Matthieu Serrano - 04/16/2005 - 05:30
Hi there,
I just wanted to let you know that I found your article extremely helpful. I just successfully moved my old drive C: to a new disk using knoppix, dd and qtparted, just as you outlined.
There was one small glitch, however. When I went to boot with the new drive, Windows 2000 was complaining about not having a paging file. Normally, I understand, Windows would attempt to create a new paging file if it can't locate the configured file. However, the issue here is that
the Windows registry didn't recognize the new drive as drive C:. This meant that many settings in the registry that pointed to drive C: (besides just the paging file) were unhappy.
To rectify the problem, I used Microsoft's knowledge base article KB223188
- http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q223188.
It might be helpful to future users to add a link.
Thanks,
-g
#2 - geoff - 06/05/2005 - 14:35
I have had fairly good luck doing this where I work. I did notice a problem with office2000 since it likes to write the 8.3 path names in the registry and if another directory gets there first, it does cause problems which I noticed recently.
I wrote most of the system in perl. I have a 2 stage boot system that loads up my perl based menu system. Stage 1 actually fits on floppy. It searches for the stage 2 which is like a mini-distro that loads into tmpfs via a tar file. Since I deal mostly with windows 2000 and xp, there are problems with hard disk geometry and the fact that the fat32 partition MUST contain the bios boot disk number. It took me several tries to realize this. Also if the heads/sectors in the fat32 boot record don't match the partition table, you will have problems as well. I have a program that installs the boot loader into fat32 for 2000/xp (same thing actually).
I came across your site because I was looking for a way to resize a fat32 partition under linux. (I have an iPod which I was forced to convert from mac hfs+ to vfat due to linux's bad support for hfs+)
#3 - Wakko Warner - 07/24/2005 - 20:26
DMA support
Hello!
I would like to suggest adding a dma enable option to your guide. I'm using knoppix 4.0 live-dvd and the copying was really slow. I enabled dma on my old PATA-drive with another root shell, and the copying became much faster. I just typed 'hdparm -d 1 /dev/hda'.
Thanks for the great yet simple guide :)
Regards,
Juho Leppämäki
#4 - Juho Leppämäki - 09/22/2005 - 03:36
Just wanted to say thanks for the guide about copying Windows you have. It's really the best and clearest of its kind that I could find on the web. I was able to rescue WinXP on FAT32 for a friend, with the only problem being that their source drive was dying...which was the reason for the move in the first place.
Again, thanks - the clear writing made it very easy.
#5 - Joshua Michael Smith - 11/12/2005 - 12:42
Great guide.
I ran across a way to get status on the dd while it is running. (It was in the manpage for dd) If you send it a USR1 signal it will output status on standard out. So you could use these commands to do the copy and output copy stats while it is working. Be sure to use the correct partions.
dd if=/dev/hdb1 of=/dev/hda1 bs=4096& pid=$!
while true ; do kill -USR1 $pid; date; sleep 10; done
That will give you stats every 10 second from the dd command. You will have to stop the while loop by hand (with a ctrl-c in the terminal) after the dd is done. The while loop will continue, but get an error.
Have fun, thanks again.
BTW. It looks like it will take 3 hours to copy a 60GB disk connected up via USB!
#6 - Brian Dolan-Goecke - 02/02/2008 - 13:18
great guide
well I used this guide to copy a 12 gig partition from my old hard drive onto a new 80 gig for windows, i use linux mostly but I use windows for games, this guide was really easy as I have not used dd before, keep up the good work
#7 - magic_ninja - 08/21/2008 - 23:24
Works bettern then DriveImage
I've spent several hours trying to copy a bootable NTFS drive with Windows XP (6 GB) to a larger one (20 GB) using the commercial Drive Image program. I was not able to do it due to various problems. After having found your tutorial, I did the job in 20 min.! Thanks a lot.
#8 - Gennady - 10/14/2008 - 23:20
Please show how to backup the entire Track0 to a file.
Maybe also add 'how to restore it before the Partitions' too.
Thanks!
#9 - J2897 - 12/06/2008 - 23:21
great directions!!! Thanks
Very cool directions...
The only issue I had is that after resizing using qtparted and rebooting, I got a no system disk or disk error message. I had to use Partition magic to set the NTFS partition to "active" and then it booted right up.
These directions are a life-saver!!!!
cheers
#10 - steve - 12/30/2008 - 16:38
Last edited by okos; 01-08-2009 at 11:56 PM.
|
|
|
01-09-2009, 02:22 AM
|
#23
|
Senior Member
Registered: Nov 2004
Distribution: Mint, MX, antiX, SystemRescue
Posts: 2,337
|
Good job getting it done! All of those other tools - G4L, CloneZilla, etc. - are just fancy apps that sit on top of dd for the most part. You just did the dd'ing manually yourself. Bravo!
Just FYI, you could have probably made more memory available under Knoppix by skipping Xwindows. At the boot prompt, where you probably just hit <enter> or waited for it to timeout and boot to default (same as hitting <enter>), you could have said "knoppix 1". This would have booted it to runlevel 1, which is single-user mode command line. No fancy desktop and mouse for you, ... just a simple command line interface where you could have run your dd's, fdisk's, etc. You probably booted Knoppix up into a memory-eating GUI interface (the default - runlevel 5), just to bring up a terminal window to access same the command line you would have had at runlevel 1.
I would recommend "System Rescue CD" as your LiveCD for these types of computer recovery/management tasks. Compared to Knoppix, it is smaller, has a newer kernel, boots to command line by default, but still includes a GUI if that's what you want. You just have to type "wizard" or "startx" to get Xwindows running. Knoppix contains huge apps - like OpenOffice - that SysRescueCD does not. But you don't need those huge apps for maintaining a system like you were doing. If you're looking for a full fledged temporary desktop replacement, Knoppix is better. For simple maintenance and recovery, SysRescueCD is better IMHO.
|
|
|
All times are GMT -5. The time now is 07:51 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|