Increase or Decrease the Size of imited/specific amount
of storage as slave to the Hadoop cluster

Linux partition

Partitioning also allows you to divide your hard drive into isolated sections, where each section behaves as its own hard drive. Partitioning is particularly useful if you run multiple operating systems. There are lots of powerful tools for creating, removing, and otherwise manipulating disk partitions in Linux.

Shut down your VM and increase the disk size

First, shut down your VM and increase the disk size. Here, I have increased the disk or added two new disks /dev/sde and /dev/sdh of size 30 GB. Then start your VM and go to the console.

Run this command to see disks

Partitioning /dev/sdh storage device

Add partitions

>> fdisk <disk_name>-> press n to create new partition and press p to create sectors
-> press p to see partition

displayed Partition

Mount the Partition and Create a New File

Next, we will mount the partition to a folder called ‘fs’ that we have created on our OS.

As we see, we have created and stored a text file ‘test.txt’.

Increase Size of Static Partition

Now, let’s see how to increase the size of this static partition.

Unmount the Partition

Delete the created partition

Create a new partition of larger size

Let’s create a new partition of a larger size. We will create a partition of 10Gib for /dev/sdh.

Configure Filesystem

Now let’s run the fsck command on the filesystem & resize the filesystem with the resize2fs command.

  • The e2fsck is used to check the ext2/ext3/ext4 family of file systems.
  • The resize2fs is a command-line utility that allows us to resize ext2, ext3, or ext4 filesystems.
>> resize2fs -f /dev/sdh1

Remount the Extended partition

>> mount /dev/sdh1 /Partition

As we can see, the previously created file is still accessible.

Decrease Size of Static Partition

Now, let’s see how to decrease the size of this static partition.

Unmount the partition

Delete the created partition

Create a new partition of smaller size

Configure Filesystem and Remount the Extended partition

Again, we have to run the fsck command on the filesystem & resize the filesystem with the resize2fs command.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store