Skip to content

Server Configuration

Change server IP address

To change a server's IP address follow these steps:

  1. Open the Netplan configuration file. This is typically located in the /etc/netplan/ directory. The file usually has a .yaml extension, for example, 00-installer-config.yaml.

    sh
    sudo nano /etc/netplan/00-installer-config.yaml
  2. Modify the configuration file to set the new IP address. Below is an example configuration:

    yaml
     network:
        version: 2
        renderer: networkd
        ethernets:
          ens160:
             dhcp4: no
             addresses:
                - 129.11.85.13/16
             gateway4: 129.11.10.1
             nameservers:
                addresses:
                  - 129.11.100.15
                  - 129.11.100.14
                  - 1.0.0.1

    Explanation of the fields:

    • network: The top-level key that starts the Netplan configuration.
    • version: The version of the Netplan configuration format.
    • renderer: Specifies the backend to use for network configuration.
    • ethernets: Defines Ethernet interfaces.
    • ens160: The identifier for the Ethernet interface. This should match your network interface name.
    • dhcp4: Specifies whether to use DHCP for IPv4. Set to no to use a static IP address.
    • addresses: A list of static IP addresses to assign to the interface. The /16 denotes the subnet mask.
    • gateway4: The IPv4 address of the gateway.
    • nameservers: DNS servers for name resolution.
    • addresses: A list of DNS server IP addresses.
  3. Apply the Netplan configuration to update the network settings:

    sh
    sudo netplan apply

Your server should now be configured with the new IP address.

Extend space on ESXII VM drive

Check Current Disk, LV, and VG Information

Check existing filesystem usage:

sh
df -h

example output:

Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              392M  1.8M  391M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   15G   13G  2.0G  87% /
tmpfs                              2.0G     0  2.0G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/loop0                          56M   56M     0 100% /snap/core18/2812
/dev/loop2                          56M   56M     0 100% /snap/core18/2823
/dev/loop1                          64M   64M     0 100% /snap/core20/2264
/dev/loop3                          75M   75M     0 100% /snap/core22/1122
/dev/loop5                          64M   64M     0 100% /snap/core20/2318
/dev/loop7                          39M   39M     0 100% /snap/snapd/21759
/dev/loop6                          68M   68M     0 100% /snap/lxd/21835
/dev/loop4                          75M   75M     0 100% /snap/core22/1380
/dev/loop9                          92M   92M     0 100% /snap/lxd/24061
/dev/loop8                          39M   39M     0 100% /snap/snapd/21465
/dev/sda2                          1.5G  209M  1.2G  16% /boot
//129.11.10.8/B2B_users            256G  190G   67G  75% /home/administrator/b2b
//129.11.2.22/emailattachments      40G  144M   40G   1% /home/administrator/itvwws22/emailattachments
tmpfs                              392M     0  392M   0% /run/user/1000

This shows your filesystem sizes, used space, and available space.

Extend the Logical Volume

Assuming your volume group (ubuntu-vg) has enough free space, you can extend the LV by, say, 15 GB using:

sh
sudo lvextend --size +15G --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv

Explanation

  • --size +15G : Increases the LV by an additional 15 GB.
  • --resizefs : Automatically resizes the filesystem to match the new size of the logical volume (saving you from having to run a separate resize2fs or similar command).

Note: If your VG does not have enough free space, you must either add a new physical disk/partition to the VG (via pvcreate and vgextend) or reduce some other LV to reclaim space.

Problems

Insufficient free space error

If you get an error similar to this:

sh
Insufficient free space: 14336 extents needed, but only 63 available

This means that the partition tables need to be updated with the new space and resized

1. Fix GPT

sh
sudo parted /dev/sda
(parted) fix          # if prompted, to correct the GPT backup table
(parted) print        # verify parted sees the full disk size (120 GiB)
(parted) resizepart 4 100%   # extend partition #4 to use all remaining disk space
(parted) quit

Explanation

  • parted /dev/sda starts the partition editor on /dev/sda.
  • If parted reports “backup GPT table is not on the end of the device,” type fix when prompted.
  • print shows the current partition layout.
  • resizepart 4 100% resizes partition #4 to occupy all unallocated space.
  • quit exits parted and saves the changes.

2. Reload Partition Table

sh
sudo partprobe /dev/sda

Explanation

  • partprobe forces the kernel to re-read the partition table changes without a reboot.

3. Resize the Physical Volume

sh
sudo pvresize /dev/sda4

Explanation

  • pvresize tells LVM that partition /dev/sda4 is now larger. It updates the physical volume metadata to reflect the new size, making extra space available for the Volume Group.

4. Extend Logical Volume and Filesystem

sh
sudo lvextend --size +15G --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv

Explanation

  • --size +15G : Increases the LV by an additional 15 GB.
  • --resizefs : Automatically resizes the filesystem to match the new size of the logical volume (saving you from having to run a separate resize2fs or similar command).

Mount windows share into linux

1. Create a Mount Point

First, ensure the directory you want to mount onto (/home/administrator/finitionlatex) exists:

sh
mkdir -p /home/administrator/finitionlatex

Explanation

  • The -p flag creates parent directories if needed and avoids an error if the directory already exists.

2. Create and Secure a Credentials File

Instead of storing your username/password in plain text in /etc/fstab, we’ll use a credentials file:

  1. Create the file: (Use your preferred editor, e.g., vi or nano.)

    sh
    nano /home/administrator/.credentials
  2. Add the following lines (adjust to your actual credentials):

    PS. If you don’t have a domain or workgroup, you can omit the domain= line or specify workgroup=WORKGROUP.

    ini
    username=YOUR_WINDOWS_USERNAME
    password=YOUR_WINDOWS_PASSWORD
    domain=YOUR_DOMAIN_OR_WORKGROUP
  3. Save and exit the editor.

  4. Set file permissions so only the owner can read/write it:

    sh
    chmod 600 /home/administrator/.credentials

    This is crucial to protect your credentials from other system users.

3. Add an Entry to /etc/fstab

  1. Next, we’ll modify /etc/fstab so your system mounts the share automatically at boot:

    Open /etc/fstab with root privileges:

    sh
    sudo nano /etc/fstab
  2. Add the following line at the bottom (adjusting paths as needed):

    sh
    //129.11.2.99/LatexData  /home/administrator/finitionlatex  cifs  credentials=/home/administrator/.credentials  0  0

    Explanation

    • //129.11.2.99/LatexData: The network path to the Windows share.
    • /home/administrator/finitionlatex: Your local mount point.
    • cifs: The filesystem type for SMB/CIFS shares.
    • credentials=/home/administrator/.credentials: Tells mount.cifs to use the specified credentials file.
    • The final two 0 0 are standard for network shares (dump and pass options).
  3. Save and exit the editor.

4. Test the Mount

  1. To apply the changes without rebooting, run:
    sh
    sudo mount -a
    Explanation
    • mount -a attempts to mount all filesystems listed in /etc/fstab that aren’t already mounted.
    • If the mount is successful, you should be able to see the share’s contents in /home/administrator/finitionlatex.

Released under the MIT License.