Este contenido no está disponible en el idioma seleccionado.
13.5. Resizing a Partition with fdisk
The
fdisk utility allows you to create and manipulate GPT, MBR, Sun, SGI, and BSD partition tables. On disks with a GUID Partition Table (GPT), using the parted utility is recommended, as fdisk GPT support is in an experimental phase.
Before resizing a partition, back up the data stored on the file system and test the procedure, as the only way to change a partition size using
fdisk is by deleting and recreating the partition.
Important
The partition you are resizing must be the last partition on a particular disk.
Red Hat only supports extending and resizing LVM partitions.
Procedure 13.4. Resizing a Partition
The following procedure is provided only for reference.
To resize a partition using
fdisk:
- Unmount the device:
umount /dev/vda
# umount /dev/vdaCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Run
fdisk disk_name. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
poption to determine the line number of the partition to be deleted.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
doption to delete a partition. If there is more than one partition available,fdiskprompts you to provide a number of the partition to delete:Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 is deleted
Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 is deletedCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Use the
noption to create a partition and follow the prompts. Allow enough space for any future resizing. Thefdiskdefault behavior (pressEnter) is to use all space on the device. You can specify the end of the partition by sectors, or specify a human-readable size by using+<size><suffix>, for example +500M, or +10G.Red Hat recommends using the human-readable size specification if you do not want to use all free space, asfdiskaligns the end of the partition with the physical sectors. If you specify the size by providing an exact number (in sectors),fdiskdoes not align the end of the partition.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the partition type to LVM:
Command (m for help): t Partition number (1,2, default 2): *Enter* Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): t Partition number (1,2, default 2): *Enter* Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Write the changes with the
woption when you are sure the changes are correct, as errors can cause instability with the selected partition. - Run
e2fsckon the device to check for consistency:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Mount the device:
mount /dev/vda
# mount /dev/vdaCopy to Clipboard Copied! Toggle word wrap Toggle overflow
For more information, see the fdisk(8) manual page.