Linux resize ntfs partitions

Чем можно изменить размер физического тома с NTFS

Доброго времени суток

Сабж. Без потери данных, естественно.

Re: Чем можно изменить размер физического тома с NTFS

Fedore’овская anaconda может

Re: Чем можно изменить размер физического тома с NTFS

ntfsresize (пакет ntfsprogs)

если не хочется читать кучу документации и сделать все быстро и безопасно

Gparted (пакет ntfsprogs все равно нужен)

Бэкап все же лучше сделать, проверка диска ntfs после изменения раздела обязательна, у меня там была куча каких то однообразных ошибок, все данные на месте

Re: Чем можно изменить размер физического тома с NTFS

Всегда считал, что gparted — морда к parted и ничего больше 🙂 Пойду перечитаю документацию. Спасибо!

Re: Чем можно изменить размер физического тома с NTFS

gparted «морда» много к чему еще, в частности к ntfsresize )

Re: Чем можно изменить размер физического тома с NTFS

вот так оно поколдовало у меня в скукоживании раздела винды )

Libparted 1.7.1
Shrink /dev/hda2 from 32.46 GiB to 21.49 GiB 01:51 ( SUCCESS )
calibrate /dev/hda2 00:00 ( SUCCESS )
path: /dev/hda2
start: 3903795
end: 71971199
size: 68067405 (32.46 GiB)

calculate new size and position of /dev/hda2 00:00 ( SUCCESS )
requested start: 3903795
requested end: 48966119
requested size: 45062325 (21.49 GiB)
new start: 3903795
new end: 48966119
new size: 45062325 (21.49 GiB)

check filesystem on /dev/hda2 for errors and (if possible) fix them 00:09 ( SUCCESS )
ntfsresize -P -i -f -v /dev/hda2
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/hda2
NTFS volume version: 3.1
Cluster size : 512 bytes
Current volume size: 34850511360 bytes (34851 MB)
Current device size: 34850511360 bytes (34851 MB)
Checking for bad sectors .
Checking filesystem consistency .
Accounting clusters .
Space in use : 10063 MB (28.9%)
Collecting resizing constraints .
Estimating smallest shrunken size supported .
File feature Last used at By inode
$MFT : 23666 MB 0
Multi-Record : 25197 MB 30191
$MFTMirr : 17426 MB 1
Compressed : 25200 MB 42034
Ordinary : 25201 MB 10941
You might resize at 10062664192 bytes or 10063 MB (freeing 24788 MB).
Please make a test run using both the -n and -s options before real resizing!

shrink filesystem 01:14 ( SUCCESS )
run simulation 00:11 ( SUCCESS )
ntfsresize -P —force —force /dev/hda2 -s 23071910399 —no-action
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/hda2
NTFS volume version: 3.1
Cluster size : 512 bytes
Current volume size: 34850511360 bytes (34851 MB)
Current device size: 34850511360 bytes (34851 MB)
New volume size : 23071909888 bytes (23072 MB)
Checking filesystem consistency .
Accounting clusters .
Space in use : 10063 MB (28.9%)
Collecting resizing constraints .
Needed relocations : 627610 (322 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time .
Resetting $LogFile . (this might take a while)
Relocating needed data .
Updating $BadClust file .
Updating $Bitmap file .
Updating Boot record .
The read-only test run ended successfully.

real resize 01:03 ( SUCCESS )
ntfsresize -P —force —force /dev/hda2 -s 23071910399
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/hda2
NTFS volume version: 3.1
Cluster size : 512 bytes
Current volume size: 34850511360 bytes (34851 MB)
Current device size: 34850511360 bytes (34851 MB)
New volume size : 23071909888 bytes (23072 MB)
Checking filesystem consistency .
Accounting clusters .
Space in use : 10063 MB (28.9%)
Collecting resizing constraints .
Needed relocations : 627610 (322 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time .
Resetting $LogFile . (this might take a while)
Relocating needed data .
Updating $BadClust file .
Updating $Bitmap file .
Updating Boot record .
Syncing device .
Successfully resized NTFS on device ‘/dev/hda2’.
You can go on to shrink the device for example with Linux fdisk.
IMPORTANT: When recreating the partition, make sure that you
1) create it at the same disk sector (use sector as the unit!)
2) create it with the same partition type (usually 7, HPFS/NTFS)
3) do not make it smaller than the new NTFS filesystem size
4) set the bootable flag for the partition if it existed before
Otherwise you won’t be able to access NTFS or can’t boot from the disk!
If you make a mistake and don’t have a partition table backup then you
can recover the partition table by TestDisk or Parted’s rescue mode.

Читайте также:  Utorent для windows 10

shrink partition from 32.46 GiB to 21.49 GiB 00:00 ( SUCCESS )
old start: 3903795
old end: 71971199
old size: 68067405 (32.46 GiB)
new start: 3903795
new end: 48966119
new size: 45062325 (21.49 GiB)

check filesystem on /dev/hda2 for errors and (if possible) fix them 00:09 ( SUCCESS )
ntfsresize -P -i -f -v /dev/hda2
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/hda2
NTFS volume version: 3.1
Cluster size : 512 bytes
Current volume size: 23071909888 bytes (23072 MB)
Current device size: 23071910400 bytes (23072 MB)
Checking for bad sectors .
Checking filesystem consistency .
Accounting clusters .
Space in use : 10060 MB (43.6%)
Collecting resizing constraints .
Estimating smallest shrunken size supported .
File feature Last used at By inode
$MFT : 19454 MB 0
Multi-Record : 11950 MB 13110
$MFTMirr : 17426 MB 1
Compressed : 11180 MB 37966
Ordinary : 22379 MB 43721
You might resize at 10059788288 bytes or 10060 MB (freeing 13012 MB).
Please make a test run using both the -n and -s options before real resizing!

grow filesystem to fill the partition 00:19 ( SUCCESS )
run simulation 00:10 ( SUCCESS )
ntfsresize -P —force —force /dev/hda2 —no-action
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/hda2
NTFS volume version: 3.1
Cluster size : 512 bytes
Current volume size: 23071909888 bytes (23072 MB)
Current device size: 23071910400 bytes (23072 MB)
New volume size : 23071910400 bytes (23072 MB)
Checking filesystem consistency .
Accounting clusters .
Space in use : 10060 MB (43.6%)
Collecting resizing constraints .
Schedule chkdsk for NTFS consistency check at Windows boot time .
Resetting $LogFile . (this might take a while)
Updating $BadClust file .
Updating $Bitmap file .
Updating Boot record .
The read-only test run ended successfully.

real resize 00:09 ( SUCCESS )
ntfsresize -P —force —force /dev/hda2
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/hda2
NTFS volume version: 3.1
Cluster size : 512 bytes
Current volume size: 23071909888 bytes (23072 MB)
Current device size: 23071910400 bytes (23072 MB)
New volume size : 23071910400 bytes (23072 MB)
Checking filesystem consistency .
Accounting clusters .
Space in use : 10060 MB (43.6%)
Collecting resizing constraints .
Schedule chkdsk for NTFS consistency check at Windows boot time .
Resetting $LogFile . (this might take a while)
Updating $BadClust file .
Updating $Bitmap file .
Updating Boot record .
Syncing device .
Successfully resized NTFS on device ‘/dev/hda2’.

Источник

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.

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.

Читайте также:  Запустить half life windows 10

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.

Читайте также:  Anno 2070 mac os

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

Источник

Оцените статью