Resize EBS volume without rebooting in AWS

This article guide you to resize the EBS volume without rebooting

1. Modify volume in AWS EC2 UI

After login to AWS console, navigate to EC2 -> Elastic Block Store -> Volumes. Click on the volume that you wist to resize, then select Actions -> Modify Volume. It will open a popup.

Now the volume has been resized, but it won't reflect in the system. We need to do some more steps to make it work.

2. Resize the partition

Lets ssh into the machine.

lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0     7:0    0   91M  1 loop /snap/core/6350
loop1     7:1    0   18M  1 loop /snap/amazon-ssm-agent/930
loop2     7:2    0 89.4M  1 loop /snap/core/6818
loop3     7:3    0 17.9M  1 loop /snap/amazon-ssm-agent/1068
xvda    202:0    0  150G  0 disk
└─xvda1 202:1    0    8G  0 part /

You can see that xvda1 is still 8 GB. Lets increase the partition to disk size.

apt install cloud-guest-utils
growpart /dev/xvda 1
lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0     7:0    0   91M  1 loop /snap/core/6350
loop1     7:1    0   18M  1 loop /snap/amazon-ssm-agent/930
loop2     7:2    0 89.4M  1 loop /snap/core/6818
loop3     7:3    0 17.9M  1 loop /snap/amazon-ssm-agent/1068
xvda    202:0    0  150G  0 disk
└─xvda1 202:1    0  150G  0 part /

3. Resize the file system

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  4.9G  2.6G  62% /
resize2fs /dev/xvda1
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      146G  4.9G  141G   3% /

So we have increased the EBS volume without rebooting and zero downtime.

View comments

Resize volume without rebooting in DigitalOcean

This article guide you to resize the DigitalOcean volume without rebooting

1. Resize volume in the UI

After login to DigitalOcean console, navigate to Volumes. Click on the volume that you wist to resize, then select More -> Increase Size. It will open a popup.

After few seconds, you can see that size of the volume has been increased. but it won't reflect in the machine. We need to do some more steps to make it work.

Also note down, mount device and mount directory for that Volume. You can see those information in More -> Config Instructions

For example, "mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_volume-01 /mnt/data".
Here "/dev/disk/by-id/scsi-0DO_Volume_volume-01" is a device and "/mnt/data" is a directory.

2. Resize the filesystem

Lets ssh into the machine.

df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   17G  2.6G  87% /
/dev/sdb         40G   28G  9.6G  75% /mnt/data
sudo umount /mnt/data
sudo e2fsck -y /dev/disk/by-id/scsi-0DO_Volume_volume-01
sudo resize2fs /dev/disk/by-id/scsi-0DO_Volume_volume-01
sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-01  /mnt/data
df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   17G  2.6G  87% /
/dev/sdb         80G   28G  52G   35% /mnt/data

So we have increased the DigitalOcean volume without rebooting.

View comments

What is the best torrent client for Ubuntu

Recently I wanted to do some research on data which is available only via torrent. Also it is a very huge file. I don't want to do this in my local machine, so I decided to spin up a Digital Ocean droplet. After some search, I found that Deluge is a best tool to do it. Deluge provides both GUI and console support. In this article, we will see how to install and use deluge from the console.

Install Deluge in Ubuntu

sudo add-apt-repository ppa:deluge-team/ppa
sudo apt-get update
sudo apt-get install deluge deluged deluge-console

Where:

How to run

1. Run Deluge daemon

deluged

This will run deluge in the background.

2. Run Deluge Console

deluge-console

This will open up new console where you can type deluge commands.

3. Add a torrent file to start download

In order to download, you need to add your torrent file to deluge using:

add -p torrent_path torrent_file_name

Where:

Example:

add -p /home/john songs.torrent

Other useful commands

You can use following commands in the deluge console.

info        - Show information about the torrents
add         - Add a torrent
rm          - Remove a torrent
cache       - Show information about the disk cache
exit        - Exit from the client.
halt        - Shutdown the deluge server.
pause       - Pause a torrent
resume      - Resume a torrent
help        - displays help on other commands

Here info is very useful command which displays current stats of the torrent download.

Hope it helps. Have a great day.

View comments