In this article, we are going to show how to resize HDD/SSD drive partitions keeping user and system data. Partition resizing is a common task if your hard drive needs to be replaced in any case (except failure) or you would like to reorganize stored data in a new way.
Since there are few major platforms on the market - Windows, Linux, OS X - we are going to overview resizing solutions for all of them. All of these systems have built-in tools and you will learn how to resize partitions with the help of them. Use the links below to jump to the section of the article that you’d like to read, depending on the OS you use:
- Resize Windows Partition
- Resize Linux Partition
- Resize Mac Partition
Before any partition-related actions are taken, please backup all your data to the separate drive or another storage device. If you don’t have the right tool yet, you may download a FREE trial of CloudBerry software for Windows Server backup, Mac backup and Linux backup that can handle this preparation task for you.
Resize Windows Partition
There are a few tools that work with drive partitions in Windows:
- Disk Management snap-in, that can help with almost every drive-related task you need.
- DiskPart tool, that can be accessed via command prompt. It has pretty much the same feature set, so we will focus on GUI.
Extending Windows Partition
In all drive management tools you will face two terms: partitions and volumes. They mean pretty much the same thing - dedicated part of a drive to store user’s or system data. But partitions are related to unformatted drive sections, while volume is a layer with a file system (FAT32, NTFS, etc.) on top of it. We will mostly use the “partition” term because the resizing action is more about bounds moving.
Knowing that, let’s open the Disk Management tool by clicking Create and format drive partitions in the Control panel.
Note: If you use the Server edition - open Server Manager and select Disk Management under Tools menu.
You can only extend any partition to unallocated space of the same hard drive (on the picture - small black part, right to C volume). Free space can also be at the left of the current partition, but you can’t extend to it if running Basic volume type.
To extend selected partition to the unallocated space do the following:
- Right-click current volume and select Extend Volume.
- Extend Volume Wizard will appear, click Next and proceed to the next step. Select unallocated space to extend on.
You can select only part of the free space or get all free space by editing Select amount of space field.
- Review summary data on the next step and click Finish - your partition is now extended.
Shrinking Windows Partition
In case one of the partitions uses a much more space than actual data contained, you may want to shorten (shrink) this partition and use new free space for partitions with more dense placement.
Shrinking is only possible for unused partition sizes.
- You can start a shrinking operation and check unused space by right-clicking on the current partition and selecting Shrink.
On the picture above you may see that the “Size of available shrink space” is 56,681 MB. It is largest free space that we can get after shrinking is completed. But keep in mind that the system partition requires some free space for normal operations - we suggest leaving free at least 20% of the current data size. Of course, this suggestion is not suitable for user volumes.
- Now enter the space you need to become reusable and click Shrink. Depending on volume’s data placement, shrinking can be completed momentarily or last some time.
Extending/Shrinking Partition “To the Left”
You may be confused about how to resize partition using free space at the start of such partition. It is possible using third-party tools, since data moving is necessary. This process is also time-consuming. Since the process depends on a particular tool - please check your third-party software manual for more info.
If you are planning to extend volume “to the left” - it is not a problem, since Windows doesn’t need to reallocate already stored data. But during this operation all volumes on the same hard drive will be converted to “Dynamic” (it is called “Dynamic drive”).
Note: Dynamic drives have advanced management features, but they have limited support by third-party disk management tools. If you are planning to use one of these tools in the future - please check whether it supports Dynamic drives or just uses Basic. Conversion Basic -> Dynamic is a one-way process, so be careful.
Above you may see free space in the middle of hard drive - it can be used to extend F volume, but only after conversion of the entire drive to Dynamic.
Resize Partition in Linux
Primary way of resizing drive partitions in Linux is to delete the old one and create a new partition, using the previous starting sector (you can think about it like “left bound of the new partition”). Then you need to simply modify the file system properties to fit the new bounds. If done carefully, you will not lose your data on modified partition, despite the terrible phrase "delete the partition".
Linux has built-in tools (commands) to work with partitions:
- df / lsblk - allows you to list available drives, including block devices.
- mount / umount - simple tools allowing you to detach a partition to change its properties.
- fdisk - partitions management tool. It will recreate partitions with newly specified bounds.
- e2fsck - allows checking of modified file system for errors.
- resize2fs - modifies existing file system to fit new partition size bounds.
In this example we are going to use Ubuntu Server 14 as an instance in Amazon EC2 cloud. So, the disk we are working with is a block EBS device called /dev/xvdb.
Note: depending on your Linux distribution and available storage devices, volume and drive names can be different. You have also use the sudo command if your current account doesn’t have “root” privileges.
Shrinking or Extending Linux Partition
First of all, let’s find the partition we want to resize. Use df -h command to list available partitions:
The last line contains the device /dev/xvdb1 - it is our working partition. Note that there are actually 2 names:
- /dev/xvdb - it is whole device.
- /dev/xvdb1 - one partition allocated on /dev/xvdb device.
You can check it using, for example, the lsblk tool (for block-level devices only):
I have created the file file_should_remain.test to check whether the resized partition did not lose its data:
We need to unmount the volume before modifications - just run the umount <mounting point> command, where mounting point is a file system’s representation of the device. And don’t forget sudo to get appropriate permissions:
Now run fdisk command with our test disk name as an argument and then type “p” to print its partitions list:
The last line contains important info about the current partition size and its bounds: “Start” and “End”. Remember “Start” value (2048 in this example). Now delete this partition by typing “d” and then type “w” to save these modifications:
After the old partition is removed we need to create the new one, either a bigger or smaller size. The following procedure is the same for both actions, but keep in mind that:
- You can extend the partition only to the space available at the “right” side. Simply saying, free space should be at the end of resizing partition.
- You cannot shrink the current partition to a size smaller than the actual data stored.
- It is a must to specify the same starting point as the previous partition while creating the new one. Otherwise you may lose your data!
In our example, the new partition will be smaller size so the Shrink operation will be performed. Let’s run fdisk again and type “n” - creating the new partition:
You may use default values in most fdisk questions, but carefully check these highlighted on the picture above: first sector (starting point) and last sector. You can use the +<size>G format to specify a desired partition size in Gigabytes (use “M” for Megabytes). Finish by typing “w” to save changes.
Now we need to verify partition consistency by running e2fsck:
Note the highlighted line - the tool shows that there is a mismatch in the file system configuration and current partition size. This is due to shrinking the partition with no changes made to the file system metadata. Just answer “no” to continue checking.
Let’s fix the error using resize2fs and then check the filesystem again:
Now the file system block size is the same as for partition configuration. Finally, let’s mount the resized volume and check that our data is still here:
Resize Mac Partition
You can perform any disks-related operations in macOS using the built-in Disk Utility. Its GUI was seriously redesigned since release of “El Capitan”, so you may notice some interface differences if running an older Mac. In this example we will use macOS High Sierra.
Disk Utility is quite a simple tool to resize partition in Mac, but there are a few recommendations that can save your time:
- If using an Apple Fusion Drive (technology that represents separate HDD and SSD drives like one logic device), never use a Disk Utility older than one used for creation of Fusion Drive. So, if you built a Fusion Drive in macOS Yosemite - don’t use OS X Lion or other older versions.
- You can only extend the partition to the free space right after the current partition. If there is something in between - you need to remove it.
- You can avoid data loss while resizing the partition only for GUID-partitioned drives. It is a common partition table for the latest Macs, but check it anyway.
Shrinking Mac Partition
You can shrink partition size with no data loss if there is unused space in its volume (remember, volume is a layer of file systems above a partition).
So, let’s check how to shrink a partition using Disk Utility:
- Open Disk Utility by typing the first part of its title in Spotlight search:
- On the picture below you can see our test configuration - external USB drive with a single partition “Test-Resizing”.
- Press the Partition button on the top and a new window with a partitions allocation pie chart will appear. You can simply add additional partitions by pressing the plus button and then using section control (2) to adjust its size. So, you will shrink the existing partition and then add the second one. Press Apply.
- Now the source partition size became lower and we got a new partition “Second test partition”.
Extending Mac Partition
Since adding a more spacious disk drive is a common way to upgrade for any Mac user, let’s try to handle it:
- Open Disk Manager, navigate to the partition you want to extend and click Partition button.
- As you can see, the pie chart consists of two partitions and you can’t directly shrink “Second test partition” to extend the first one. We need to remove the second partition by pressing the “minus” button and then select a new size for the “Test-Resizing” partition. By default, Mac will choose all available space. Click Apply after selecting the proper volume size, so changes can be applied.
If your secondary partition is not empty, you can move its data to another drive’s partition or just create its backup using Apple Time Machine or third-party backup tool.
If you need to migrate your PC from one platform to another, consider using a cross-platform backup tool. It can help in case you can’t directly copy the data from one drive to another. For example, a backup tool with the support of cloud storage can help if you want to replace desktop Windows OS with Linux distribution and need to completely reorganise system hard drive.
Now you know more about how to resize partitions on the most popular platforms. Remember to create a backup copy each time when resizing or moving disk volumes. If you don’t have suitable tool - you can use our CloudBerry Backup for FREE with no limitations during a 15-day trial period.
Don't hesitate to contact us if you have any remaining questions!