Javier Barber
Senior Sysadmin Freelancer
CAMBIAR TAMAÑO PARTICIÓN NTFS VM WINDOWS 2003 SERVER ESX
Pasos a realizar:
1.- Ampliar el disco desde las opciones de la VM.
2.- Comprobar en el Windows que efectivamente se ha aumentado el tamaño del disco y que aparece sin particionar
3.- Reiniciar ordenadamente el Windows
4.- Arrancar la VM con un LiveCD de Linux
5.- Instalar las «ntfsprogs»
6.- Comprobar el estado actual de las particiones del disco con fdisk -l :
debian:~# fdisk -l
Disk /dev/sda: 62.2 GB, 62277025792 bytes
255 heads, 63 sectors/track, 7571 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb1cfb1cf
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5222 41945683+ 7 HPFS/NTFS
En este caso por ejemplo el disco tiene 62.2 GB de tamaño total pero la partición es de (5222 cilindros * 8225280 bytes = 40962 MB)
Comprobar el estado de la partición NTFS y del disco con:
debian:~# ntfsresize -i /dev/sda1
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 42952376832 bytes (42953 MB)
Current device size: 42952379904 bytes (42953 MB)
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 42888 MB (99.8%)
Collecting resizing constraints …
You might resize at 42887487488 bytes or 42888 MB (freeing 65 MB).
Please make a test run using both the -n and -s options before real resizing!
Vemos que el volumen ocupa lo mismo que el dispositivo por lo que no podemos aumentar el tamaño. Para ello debemos aumentar el tamaño de la partición primero con:
debian:~# fdisk /dev/sda
The number of cylinders for this disk is set to 7571.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 62.2 GB, 62277025792 bytes
255 heads, 63 sectors/track, 7571 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb1cfb1cf
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5222 41945683+ 7 HPFS/NTFS
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-7571, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-7571, default 7571):
Using default value 7571
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
Disk /dev/sda: 62.2 GB, 62277025792 bytes
255 heads, 63 sectors/track, 7571 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb1cfb1cf
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7571 60814026 7 HPFS/NTFS
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Comprobamos de nuevo los tamaños de la partición y del disco:
debian:~# ntfsresize -i /dev/sda1
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 42952376832 bytes (42953 MB)
Current device size: 62273562624 bytes (62274 MB)
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 42888 MB (99.8%)
Collecting resizing constraints …
You might resize at 42887487488 bytes or 42888 MB (freeing 65 MB).
Please make a test run using both the -n and -s options before real resizing!
Ahora vemos que la partición ocupa menos que lo que tiene el disco.
Probamos la ampliación de la partición con:
debian:~# ntfsresize -n -s62200M /dev/sda1
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 42952376832 bytes (42953 MB)
Current device size: 62273562624 bytes (62274 MB)
New volume size : 62199992832 bytes (62200 MB)
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 42888 MB (99.8%)
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.
Como vemos que está todo correcto procedemos a realizar la ampliación definitiva:
debian:~# ntfsresize -s62200M /dev/sda1
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 42952376832 bytes (42953 MB)
Current device size: 62273562624 bytes (62274 MB)
New volume size : 62199992832 bytes (62200 MB)
Checking filesystem consistency …
100.00 percent completed
Accounting clusters …
Space in use : 42888 MB (99.8%)
Collecting resizing constraints …
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)
Updating $BadClust file …
Updating $Bitmap file …
Updating Boot record …
Syncing device …
Successfully resized NTFS on device ‘/dev/sda1’.
Rebotamos la VM:
debian:~# reboot
Al inicio del Windows se forzará la comprobación del disco con CHKDSK. Debemos dejar que se complete y se reinicie automáticamente.
Cuando haya reiniciado ya tendremos ampliada la partición.