Virtual Machine Management

Register or login to post to the forum.
22 Sep, 2015 20:45

Setting up and managing your cloud VM

15 Dec, 2015 22:54

listening on what port?

# lists all applications listening on ports
sudo netstat -nlp
sudo netstat --tcp --programs

# list of processes listening on that port
sudo lsof -t -itcp:443
sudo lsof -i tcp:22
sudo lsof -n -P -i +c 13

# list of pids using this port
sudo fuser 43796/tcp

Suggestions? smile

13 Jul, 2016 16:01

Adding a new volume to an ubuntu vm at aws

  1. Create an empty volume using the volumes tab.
  2. Select that volume in AWS (blue dot on that line selected). Click "Attach Volume" at the top and put in the name or the id of the instance you want to attach it to.
  3. SSH into your instance and in terminal type "sudo lsblk" which should look about like this.

    sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 16G 0 disk └─xvda1 202:1 0 16G 0 part / xvdf 202:80 0 100G 0 disk

Note the xvdf shows as a disk but not a partition. It is assumed that drives are attached in the /dev/ folder. And the name in linux "xvdf" in this case, does NOT match the name when attaching the volume with the AWS console. Sometimes they are close like "/sdf" but still not the same as "/dev/xvdf".

So far we now have a 100GB useless brick attached to our instance. If you don't see it with "lsblk" you may have to reboot the instance. Once you can see it with lsblk we want to verify it is empty.

 sudo file -s /dev/xvdf
 /dev/xvdf: data

The result of "/dev/xvdf: data" means it doesn't even have a file partition on it. So create it with the following. And I just take the defaults for blocks.

 sudo mkfs -t ext4 /dev/xvdf

And finally create a mount point (directory) to attach it.

 sudo mkdir /logfiles
 sudo mount /dev/xvdf /logfiles

To verify it do two things. "lsblk" and make a test file on that drive to check your partitions.

 sudo lsblk
 # should show the last line as
 xvdf    202:80   0  100G  0 disk /logfiles
 cd /logfiles
 touch test.txt

If you want it to be permanent on reboot then edit the file named /etc/fstab (read up on options here - google it) but the basic line to have the drive automatically mount on boot is listed in this more in depth post