- Ubuntu Documentation
- Introduction
- Recommended Preparations
- Backup
- Run CHKDSK
- Defragging
- Resize the Windows partition
- Windows XP
- Windows Vista and Windows 7
- Ubuntu CD Installer
- GParted Partition Editor
- Windows Disk Management
- Immediately Reboot Windows After Shrinking Partition
- Problems
- Other resources
- How to efficiently partition a single Windows-Ubuntu dual boot disk?
- 3 Answers 3
- I know Windows well but Ubuntu not so well
- I’m an expert at both Windows and Ubuntu
Ubuntu Documentation
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.
Recommended Preparations
Before editing the Windows partition, you should backup, clean, run a file system check, and/or defrag the partition.
Backup
It may seem obvious, but you should always back up important data to an external medium (CD, DVD, USB flash drive, or external hard drive) prior to manipulating your hard drive, in case it becomes corrupted. You should also clean up unnecessary files on the hard drive.
Run CHKDSK
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. 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’. Windows can’t check your file system while it’s mounted, but you can set it to do so at the next reboot.
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 (the option for automatically fixing errors).
Defragging
If you are planning to use GParted, you can skip defragging and save yourself some time, because GParted can resize an NTFS partition 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 defragment, possibly overnight. Very often while you’re defragging, 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 (which often times you don’t). Go into Control Panel and in ‘System’, ‘System Properties’, and then ‘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 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.
Resize the Windows partition
A Windows partition should be at least 20 GB (recommended 30 GB for Vista/Windows 7), and the Ubuntu partition at least 10 Gb (recommended 20 GB). Obviously, if you have plenty of disk space, you can make the partition for your favored operating system larger.
Windows XP
If using Windows XP (or an older Windows OS), you should use GParted partition manager to shrink the Windows partition and leave free space on the hard drive for the Ubuntu partition.
Windows Vista and Windows 7
There are several ways you can reduce the size of a Windows 7 or Vista partition. 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 Linux partition editors are on the Ubuntu CD, one being the installer and the other being GParted Partition Editor.
Ubuntu CD Installer
The Ubuntu installer has its own inbuilt partitioner so there’s really no need to partition your disks beforehand if you don’t want to. The Ubuntu CD’s partitioner is based on GParted, but doesn’t round cylinders or move the start of the Windows partition. Windows will run a normal file system check on first boot-up and then it will boot normally.
GParted Partition Editor
If you decide to use GParted, you have to remember to uncheck the ’round to cylinders’ checkbox , otherwise GParted will dutifully move the entire partition to align it with cylinder boundaries. Unfortunately this takes a long time, and when it’s finished, usually results in booting problems. This is because the Windows boot loader 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 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.
Some hardware vendors (such as Dell) ship with the maximum of four primary partitions occupied. It is simpler to install Ubuntu on at least one primary partition (using Windows bootloader is required for installing on a logical partition). Using GParted may be preferable in this circumstance to utilize the space occupied by the recovery partition or media direct partition.
Windows Disk Management
The Windows Disk Management tool is also 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
In Windows Vista and Windows 7, this may be located in:
Settings -> Control Panel -> Administrative Tools -> Computer Management -> Storage -> Disk Management -> Shrink Volume
Immediately Reboot Windows After Shrinking Partition
After shrinking the Windows partition, you should reboot once (or twice) into Windows prior to installing Ubuntu. This allows the Windows system to automatically rescan the newly-resized partition 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 not boot entirely. If this happens, you may later have to repair the Windows partition bootup files manually using the Windows Recovery Console.
Problems
As with all major changes to a computer, problems may sometimes occur, especially if dealing with Windows Vista or 7.
According to one Windows user:
Unlike Windows XP, Windows Vista and Windows 7 do not allow you to move the MFT (Master File Table) that controls the NTFS file structure within Windows. 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 is likely to 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.
However, the partitioner in the Ubuntu installer has been used quite successfully by thousands of people for years and there’s really no reason why you can’t just use the Ubuntu installer’s inbuilt partitioning program.
If you find you cannot boot into Windows, this guide on recovering Windows may help.
Other resources
Parts of this page have been adapted from information at Ubuntuguide — Multiple OS Installation.
HowtoResizeWindowsPartitions (последним исправлял пользователь robert-gagne 2012-09-20 02:59:30)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details
How to efficiently partition a single Windows-Ubuntu dual boot disk?
This is not a question on how to install Ubuntu or how to use manual partitioning during installation but is a question on access rights and how not to let them bite you in the lower abdomen. 😉
This question will not help you how to make partitions on your disk, but will tell you what to do in step 4 of the installation process, depending on your personal use case, so choose one of the following:
Note: The above questions can also be used with multiple disks, but the examples in the answers are given for one disk.
3 Answers 3
I know Windows well but Ubuntu not so well
(or the other way around)
Both Windows and Ubuntu are POSIX compliant operating systems and they both allow you to define which user has access to which individual file, directory, partition or disk!
But they do it just a little bit differently (There are full-time jobs for people who have to clean up wrong ownership of data all day long!)
So take the average hard disk:
If you have more then 1 partition, you’re probably running an UEFI system. Please, do not delete any of those partitions! Concentrate on the biggest partition you have and use that one in the following exercise.
Depending on your use case give each OS enough space for its own system and applications (the below numbers are the minimum and recommended system requirements, so you should multiply them by a factor that is comfortable for your use case)
- Windows 10 : 20 GB minimum, >=32GB recommended
- Windows 8 : 20 GB minimum, N/A recommended
- Windows 7 : 20 GB minimum, >=35GB recommended
- Windows Vista : 15 GB minimum, >=35GB recommended
- Windows XP : 4 GB minimum, N/A recommended
- Ubuntu Desktop : 4 GB minimum, 25GB recommended
- Ubuntu Server : 1 GB minimum, 25GB recommended
Note: Ubuntu also needs a swap partition of a size described here.
The rest of the disk (-10%) can be given to a data partition formatted to NTFS from gparted See note below so that you arrive at the following lay-out:
- Install Windows
- Create all your users under Windows
- Install Ubuntu
- Create all your users under Ubuntu giving them both the same name and the same password as under Windows.
- Boot the Ubuntu Live CD again and run gparted and shrink both Windows and Ubuntu partitions until they take twice to thrice the amount of the pale yellow bar. Then create the data partition and format it to «ntfs»
- mount this partition in your fstab (E.g. /media/data )
The following steps credit to:user68186, copied from here
Move your data directories to the /Data mount point by pressing Ctrl + Alt + T and copy-paste each line followed by Enter (replace «UserName» by your user name):
Make symbolic links for your user to the above directories somewhere else
Go to Windows again and move the user directories to your D: drive in the users directory.
Why?
When you boot into Windows (or Ubuntu), both Windows and Ubuntu have their own system files and applications installed in their own environment. On top of that, you don’t have to worry about which file goes where: All Ubuntu files can be found under Windows in the d:\home directory and all your Windows files can be found under the /users directory in Ubuntu.
If you use any of the following:
- Ubuntu commands: chown , chmod or Windows command: cacls ,
- if you use any of the file managers to right-click on directories or files to use set permissions
then please do not set permissions from inside Windows in the D:\home nor from inside Ubuntu on the /Users directory ever! Also, do not move files between /users and /home (or D:\home and D:\Users ) ever! ###Only copy files!
(and then delete the original because moving will try to move the permissions from one totally different file system to another and that’ll give you troubles you want to avoid)
Why is there 10% unallocated space on your drive? Well, that’s a little trick when your PC is brand new: you don’t need all that space, and that free space is your proverbial spare tire if you ever need to extend one of the other partitions when they run flat! 😉
Now go back to step 5 of the How to Install Ubuntu and continue there.
I’m an expert at both Windows and Ubuntu
Good! Welcome! 🙂 You’ve probably read the non-expert versions above and wondered what’s in it for you.
Well, I’m not going to tell you that:
- creating 4 primary partitions on one single MBR drive is locking yourself in a corner (though some of the users above will have them on a GPT drive),
- nor what partitioning scheme to use to install your OS: that’s what the FHS and the Microsoft Server Install Guidelines are for
- nor that Microsoft server isn’t really a POSIX compliant server any more, but an Interix subsystem.
- to speed up boot, put your OS files on the SSD for both Ubuntu and Windows and your data files on the HDD
it is a bad idea to create swap space on an SSD (though it’s getting better) for both Ubuntu and Windows.
You know all that, right?
Well, what you might not know about interoperability between NTFS and Ubuntu is that:
- File ownership and permissions can be interoperable between Windows and Ubuntu.
- Windows-Unix compatible ACLs can be defined
- That Windows Junction points can be seen as Ubuntu symbolic links.
- Creating and updating compressed files can be supported.
However, you must
- use correct mount options: inherit , permissions , streams_interface=windows , hide_hid_files , windows_names , compression
- creating a /.NTFS-3G/UserMapping file with ntfs-3g.usermap and then manually edit it ( permissions above not needed)
- To be able to do an image back-up, mount the volume with ro and efs_raw
- Do the administration of complex rights always on the host system!
- Use the ntfs-3g-advanced driver (to get all bells and whistles)
- Create ACLs (recompile driver, set option —enable-posix-acls in the configure command)
- Create Windows Junctions on Windows and define them in /.NTFS-3G/ (E.g. /.NTFS-3G/D:/Users)
For all the whistles and bells: man ntfs-3g and the advanced options article by one of the creators of ntfs-3g .