Anyone who has a server that offers service can be seen in the situation of running out of space. If we use a Cloud service, expand the disk can be as easy as sliding the mouse, but high… not everything is so easy.
Change the size of a disk without stopping the service is complex, impossible if we do not have an alternate server that offers service while we do maintenance. Although they are only a couple of minutes, it is necessary to have a downtime. Remember to make backup copies.
Removing the base, this is what we must do when we want to expand the disk on a Linux computer. Take for example/dev/sdb
- We must have the extended disc, i.e. we have a 25 GB disk, we ask our suppliers to us the expand (to 50 GB for example)
- In console:
- Stop all services that may be using the disc (here comes the problem of Downtime)
- Unmount the disk to expand
umount /dev/sdbX
- Once removed, we access the fdisk
Fdisk/dev/sdb
of #(Delete a Partition) and delete the partition that you want
n #(Add a new Partition) with the same characteristics as the previous one, changing the final inode.
w #(Write Table and Exit) save and salirfdisk/dev/sdb
Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): d
Selected partition 1
Partition 1 is deletedCommand (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-104857599, default 2048):
Using default value 2048
Last sector, + sectors or + size {K, M, G} (2048-104857599, 104857599 default):
Using default value 104857599
Partition 1 of Linux and of size 50 GiB type is set - With this we already have changed the size of the disk, but now we need to change the partition
e2fsck - f/dev/sdb1 # fsck the disk, to validate that it is correct
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
lost+found not found. Create? Yes
Pass 4: Checking reference counts
Pass 5: Checking group summary informationresize2fs/dev/sdb1 # resize
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on/dev/sdb1 to 13106944 (4 k) blocks.
The filesystem on/dev/sdb1 is now 13106944 blocks long.
With this we have completely changed the disc, if we assemble, already have it correctly.
Do it under your own supervision… and by seacaso: p
RECOMMENDATION AND TUTORIAL IS OFFERED "AS-IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN ANY CASE THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITIES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ACTIONS IN THE SOFTWARE. |