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.
- i) Enter the new size in the size field. Lets says we are resizing from 8 GB to 150 GB.
- ii) Click Modify button
- iii) Click Yes button in the confirm 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.
- i) List block devices attached to 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.
- ii) Install
cloud-guest-utils
apt install cloud-guest-utils
- iv) Let's check the partition size (you can see /dev/xvda1 is now 150 GB):
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
- i) Check the file system size. (Still it shows only 8 GB)
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 4.9G 2.6G 62% /
- ii) Resize the filesystem
- iii) Check after resizing
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.
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.
- i) Enter the new size in the size field. Lets says we are resizing from 40 GB to 80 GB.
- ii) Click Resize Volume button
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.
- i) Check the file system size. (Still it shows only 40 GB)
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
- ii) Unmount the directory. (If any process writes into this directory, just stop it and start after you finish below steps.)
sudo e2fsck -y /dev/disk/by-id/scsi-0DO_Volume_volume-01
- iv) Resize the filesystem
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.
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:
deluge
- torrent client GUI
deluged
- torrent client daemon
deluge-console
- torrent client console
How to run
1. Run Deluge daemon
This will run deluge in the background.
2. Run 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:
torrent_path
is a path where you have your torrent file.
torrent_file_name
is actual torrent file name
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.