个人工具

UbuntuHelp:HowtoResizeWindowsPartitions

来自Ubuntu中文

跳转至: 导航, 搜索

Introduction

It is possible to have several partitions on a hard-drive, each of which can contain an operating system (for dual-boot or multi-boot purposes). In order to make room for an Ubuntu partition, however, a pre-existing Windows partition may need to be shrunk first. This page details the method for resizing Windows partitions.

Backup, Clean, and Run a File System Check and/or Defrag the Windows partition

It may seem obvious, but you should backup important data to an external medium (CD, DVD, USB flashdrive, or external hard drive) prior to manipulating your hard drive, in case the hard drive becomes corrupted. You should also clean up unnecessary files on the hard drive and run CHKDSK on the drive before resizing the Windows partition. CHKDSK is your file system checking tool in Windows and it is used for fixing errors and displaying a status report. If the status report indicates no health problems in your hard disk, then it should be safe to go ahead with your resize operation. The easiest way to run CHKDSK is to schedule it to run on the next reboot. Just go to 'My Computer', right-click on drive C, select the 'tools' tab, and click 'check now' in the 'error checking' section. Windows can't really check your file system while it's mounted, but you can set it to do so at the next reboot. Make sure you check both squares, one for 'automatically fix system errors', and the other one for 'scan for and attempt the recovery of bad sectors'. Some people run CHKDSK from a Windows Recovery Console in a Windows Installation CD, and this is sometimes necessary if Windows won't even boot. You need to make sure you use a CD for your version of Windows because there are different versions of NTFS. If you run CHKDSK from a Windows Recovery Console, be sure to run CHKDSK /R, for a thorough file system check which will take longer, and includes /F. If you are planning to use GParted, you can skip defragging and save yourself some time, GParted can resize an NTFS partition just as safely regardless of its state of fragmentation. See / How to resize NTFS without data loss? (Feb 24, 2005)- The ntfsresize Frequently Asked Questions, and 2.4.13 resize - Parted Users Manual If you're planning on using Windows Disk Management, most people will advise you to defrag, possibly overnight. Defragging is usually a good thing to do at any time, even if you're not planning to resize. Hint: Very often there will be a large green bar in the middle of the Windows partition that seems to be immovable. That's the Windows 'page file', and you can turn that off before defragging if you need to by going into control panel and in 'System', System Properties', 'Advanced' tab, look for the 'Performance Settings' button. In the Advanced tab look for 'virtual memory' and be sure to take note of your settings on paper before making any changes. Then click the radio button for 'no paging file' and click 'Apply'. Now you can run defrag without the big green immovable bar in the way. Remember to turn your paging file back on later on or your Windows operating system might be slowed down at times. I have read that the Windows Disc Management resizer has the limitation of not being able to fully resize the file system due to this page file, but I have not yet tested resizing with that utility when the page file is turned off.

Resize the Windows partition

A Windows partition should be at least 20 Gb (recommended 30 Gb for Vista/Windows 7), and an Ubuntu partition at least 10 Gb (recommended 20 Gb). Obviously, if you have plenty of disk space, make the partition for whichever will be your favored operating system larger.

Windows XP

If using Windows XP (or other older Windows OS), you can use the GParted partition manager to shrink the Windows partition and thereby leave free space on the hard drive for the Ubuntu partition.

Windows Vista and Windows 7

Some people think that the Windows partition must be resized only from within Windows Vista and Windows 7 using the shrink/resize option. There are several ways you can reduce the size of a Windows 7 or Vista partition and you can choose either the Windows way or one of the Gnu/Linux methods depending on which one you want to put your faith in. It doesn't really matter which one you choose. Linux programs get the job done faster because you don't need to defrag first, but using the Windows Disk Management would be the more conservative option. Two of the free Gnu-Linux partition editors are the one built into the Ubuntu CDs installer and GParted Partition Editor. If you use GParted Partition Editor in the Ubuntu Live CD be careful. You should remember to remove the check mark in the 'round to cylinders' checkbox , otherwise GParted will dutifully move the entire partition to align it with cylinder boundaries. Unfortunately that takes a long time and when it's finished it usually results in booting problems. This is because the Windows boot loader is not as sophisticated as Linux boot loaders and depends on block addressing to find parts of itself, so when the partition is moved a little, it gets all mixed up and disjointed. Sometimes it can fix itself automatically but other times it requires repairs from the Windows Installation Disc. If you just remember to remove the check mark you will find that GParted will be able to complete the NTFS resize in a fraction of the time it would have taken otherwise and afterwards Windows will boot just fine. The Ubuntu installer has its own inbuilt partitioner so there's really no need to partition your disks before hand if you don't want to. The Ubuntu installer's inbuilt partitioner is based on GParted but it works to a different set of rules and it doesn't move the start of the Windows partition so there's no checkbox to worry about if you decide to carry out the partitioning operating during the installation procedure. Windows will run a normal file system check on first boot-up and then it will boot normally. The Windows Disk Management tool is also very good at shrinking Windows, it's very fast and easy, if you don't count the time it takes to defrag first. If you want to use the Windows partition editor to resize Windows, here's how you can do that, Administrative Tools --> Disk Management tool -> Shrink Volume This may also be located in Windows Vista and Windows 7: Settings -> Control Panel -> Administrative Tools -> Computer Management -> Storage -> Disk Management -> Shrink Volume According to one Windows user: Unlike Windows XP, Vista and Windows 7 does not allow you to move the MFT (Master File Table) that controls the NTFS file structure. Inexplicably, Microsoft locates this near the middle (or end) of the partition, somewhat limiting the ability to resize (shrink) the partition completely. Although you will be able to gain some hard drive space from the "Shrink Volume" command, it will be limited. I knew of no partition software that could move the MFT to a different place on the hard drive safely, but this tutorial suggested that Perfect Disk worked for this purpose. I therefore tried the trial version of Perfect Disk, and it seemed to work for me very nicely. I was able to shrink my Vista partition, using the steps in the tutorial (and Perfect Disk), from 300 Gb to 74 Gb. This was perfect for me. That sounds like an advertisement for a proprietary disk partitioning utility doesn't it? The letters MFT stand for Master File Table, which means the metadata for the NT File System. For more info on NTFS, http://en.wikipedia.org/wiki/NTFS The point of view of someone who is interested in free, open source software is that GParted in the Ubuntu installer has been used quite successfully by thousands of people for years and there's no reason why you can't just use the Ubuntu installer's inbuilt partitioning program. It uses ntfsprogs, URL http://www.linux-ntfs.org/doku.php for NTFS support and the people at ntfsprogs keep up with all of the latest developments in the NTFS file system. The goal of the Linux-NTFS project is to write a better, open source NTFS driver than the Windows one. For more info on NTFS and ntfsprogs, http://www.linux-ntfs.org/doku.php?id=ntfs-en

Immediately Reboot Windows after shrinking partition

After shrinking the Windows partition, you should reboot once (or twice) into Windows prior to installing Ubuntu (or using GParted). This allows the Windows system to automatically rescan the newly-resized partition (using chkdsk in earlier versions or a similar utility in later versions) and write changes to its own bootloader configuration files. If you start mucking around with other partitions before Windows has a chance to reset itself, the Windows bootloader will not be able to read the partition table properly (and will therefore refuse to boot entirely). If this happens, you may later have to repair the Windows partition bootup files manually using the Windows Recovery Console.

Other resources