Zmiana wielkości partycji NTFS w pod linux'em

9 April 2015

na odmontowanym dysku:

sudo ntfsresize --info /dev/sdb2
Device name        : /dev/sdb2
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 500000879104 bytes (500001 MB)
Current device size: 500000882688 bytes (500001 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 42992 MB (8.6%)
Collecting resizing constraints ...
You might resize at 42991591424 bytes or 42992 MB (freeing 457009 MB).
Please make a test run using both the -n and -s options before real resizing!

 

Testy (--size określa wielkość nowej partycji):

sudo ntfsresize --no-action --size 50000M  /dev/sdb2

Jeżeli wszystko jest ok:

Device name        : /dev/sdb2
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 500000879104 bytes (500001 MB)
Current device size: 500000882688 bytes (500001 MB)
New volume size    : 49999995392 bytes (50000 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 42992 MB (8.6%)
Collecting resizing constraints ...
Needed relocations : 9000796 (36868 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...
100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully

wykonujemy polecenie w trybie zapisu:

sudo ntfsresize --size 50000M  /dev/sdb2
Device name        : /dev/sdb2
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 500000879104 bytes (500001 MB)
Current device size: 500000882688 bytes (500001 MB)
New volume size    : 49999995392 bytes (50000 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 42992 MB (8.6%)
Collecting resizing constraints ...
Needed relocations : 9000796 (36868 MB)
WARNING: Every sanity check passed and only the dangerous operations left.
Make sure that important data has been backed up! Power outage or computer
crash may result major data loss!
Are you sure you want to proceed (y/[n])? y
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Relocating needed data ...

trochę to trwa a czekamy na:

100.00 percent completed
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sdb2'.
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.

Zmiana wielkości partycji:

sudo fdisk /dev/sda
Command (m for help): p
Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x14cc98c0

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdb1  *      2048    206847    204800   100M  7 HPFS/NTFS/exFAT
/dev/sdb2       206848 976771071 976564224 465.7G  7 HPFS/NTFS/exFAT

kasujemy  partycje 2 (/dev/sdb2) (opcja d)

Tworzymy nową partycje o wielkości zmniejszonej do rozmiaru + 150 M: (opcja n)

Zmieniamy typ partycji (t na 7)

wykonujemy ostateczny test:

sudo ntfsresize --info --force /dev/sdb2

 


Device name        : /dev/sdb2
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 49999995392 bytes (50000 MB)
Current device size: 52575600640 bytes (52576 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use       : 42978 MB (86.0%)
Collecting resizing constraints ...
You might resize at 42977857536 bytes or 42978 MB (freeing 7022 MB).
Please make a test run using both the -n and -s options before real resizing!

 


Kategorie: Windows, Linux