Sim, podemos fazer isso usando resize2fs, então:
Primeiro, precisamos saber sobre o espaço livre:
root@server:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 3,7T 1,5T 2,1T 42% /users/home
Agora prossiga para redimensionar:
root@server:~# resize2fs /dev/sdb1 2500G
resize2fs 1.42 (29-Nov-2011)
Por favor ejecute antes 'e2fsck -f /dev/sdb1'.
Então, bem, precisamos verificar nosso disco antes de prosseguir. Então, sua lógica:
root@server:~# e2fsck -f /dev/sdb1
e2fsck 1.42 (29-Nov-2011)
Paso 1: Verificando nodos-i, bloques y tamaños
Paso 2: Verificando la estructura de directorios
Paso 3: Revisando la conectividad de directorios
No se encontró /lost+found. Crear? no
Paso 4: Revisando las cuentas de referencia
Paso 5: Revisando el resumen de información de grupos
/dev/sdb1: ***** EL SISTEMA DE FICHEROS FUE MODIFICADO *****
/dev/sdb1: 3281220/244064256 files (0.4% non-contiguous), 383150021/976236032 blocks
Agora, tudo bem!
resize2fs 1.42 (29-Nov-2011)
Resizing the filesystem on /dev/sdb1 to 655360000 (4k) blocks.
The filesystem on /dev/sdb1 is now 655360000 blocks long.
Agora, precisamos excluir nossa patização e recuperar nossa partição com um novo tamanho.
Podemos usar o Fdisk, mas se o nosso HD for "grande", podemos usar o parted.
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
WARNING: The size of this disk is 4.0 TB (3998663944192 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
Using fdsik, we must put start from block 1 to last block that resize2fs, in our case was 655360000 and multiply by 4 (its k in every block). To get some safe margin, We can multiply this again by 1.05 and in this way you got a little more of space.
In parted, is very similar, like fdisk:
root@server:~# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
Warning: /dev/sdb contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was
corrupted -- possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos partition table. Is this a GPT
partition table?
Yes/No? Yes
(parted)
(parted) print
Model: DELL MD32xxi (scsi)
Disk /dev/sdb: 3999GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
(parted) mkpart primary 0GB 3000GB
(parted) print
Model: DELL MD32xxi (scsi)
Disk /dev/sdb: 3999GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 3000GB 3000GB ext4 primary
(parted) quit
Information: You may need to update /etc/fstab.
Pronto! Agora temos uma nova partição ...