Extend a partition hot on Linux with fdisk

From EN Ikoula wiki
Revision as of 16:11, 9 February 2017 by Ikbot (talk | contribs) (Created page with "<br />This article has been created by an automatic translation software. You can view the article source here.<br...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽


This article has been created by an automatic translation software. You can view the article source here.

/!\ ATTENTION: Il est conseillé de faire des backups de vos données avant toutes modifications /!\
/!\ ATTENTION: Il est conseillé de faire des backups de vos données avant toutes modifications /!\

Introduction

In this article you will see how to extend a partition hot on Linux with fdisk.

Context

In our case, we will have a partition mounted on /var, named /dev/xvdb1 who does 10GB
We would like to extend this partition to the maximum (xvdb made 20GB)

Place

Disassembly of the partition

In order to make any changes on a partition, he must take it apart.

The command to unmount our partition is:

 umount /dev/xvdb1


An error of the type:
Umonterror.PNG

Please close the process on this score as well as open files with their programs or related it users:

Process:

 fuser -kmiuv /dev/xvdb1


Open files:

 lsof | grep /var


Partitioning

Type the command:

 fdisk


Choose the disk on which is the partition to extend:

 fdisk /dev/xvdb


/!\ Étape très importante /!\
Tapez

 p

Afin de noter le cylindre de début de la partition, ici 2048.
Blocstart.PNG

Enter this option to delete the partition in the partition table, this does not erase the data on the disc:

 d

Then enter the number of the partition to delete.

Then enter this option to create a new partition:

 n

Enter the number that you noted above for the First sector and the default number for the Last sector (If you want to extend it to the maximum)
Sector.PNG

If everything went well spent so far, we will save the new table of partitions with this option:

 w


Restart:

 reboot


It remains more to extend the filesystem with the command:

 resize2fs /dev/xvdb1



You are not allowed to post comments.