Adding new disk to Ubuntu

Reading Time: 2 minutes

Last edit: 2/27/2022

This will be a simple example. This should document how to add an additional disk to an Ubuntu system. In this example I am using VMware as the hypervisor. I will assume cane edit the virtual machine and add a new disk. In this example the new disk is /dev/sdb

$ hwinfo --block --short
  /dev/sdb             VMware Virtual disk
  /dev/sda             VMware Virtual disk
  /dev/sda1            Partition
  /dev/sda2            Partition
  /dev/sr0             NECVMWar VMware SATA CD00
$ pvcreate /dev/sdb
$ vgcreate vg00 /dev/sdb
$ vgdisplay -s
  "vg00" <16.00 GiB [0         used / <16.00 GiB free]
$ lvcreate -n vol_nfs -l 100%FREE vg00

In this example we are going to create a logical volume – however we are going to make a mistake on purpose. We are going to mistakenly create a volume named “vol_temp”

$ lvcreate -n vol_temp -l 100%FREE vg00

Oops. We have done it again. Having realized our “mistake” we will now rename the logical volume to the name “lvweb”

$ lvrename vg00 vol_temp lvweb
  Renamed "vol_temp" to "lvweb" in volume group "vg00"

Now we will format the logical volume / disk.

mkfs.ext3 /dev/vg00/lvweb
mke2fs 1.46.3 (27-Jul-2021)
Creating filesystem with 4193280 4k blocks and 1048576 inodes
Filesystem UUID: b6ea2916-de9d-495c-8628-195a12785d8d
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

You may choose to mount a volume: (this example differs slightly from the above example). This is handy or useful when you need to perform some form of initial manipulation.

$ mount /dev/vg01/volweb /mnt

Let’s list the block and learn about the disks in the process.

$ lsblk -f 
< edited ... >
sdb  LVM2_m LVM2        mzHFaq-BPeU-dhUk-W0kT-gF0l-TdGj-s5d7WO
     ext3   1.0         b6ea2916-de9d-495c-8628-195a12785d8d

To mke this permanent you would put the following in the /etc/fstab file.

UUID=b6ea2916-de9d-495c-8628-195a12785d8d /var/www/archive   ext3 defaults 0 2


As an aside you might be curious about the speed/timing of the drive. This will be covered in more details in a seperate post. In this example on the ESXI host I am using I am using a NFS mount over a simple 1G NIC.

$ hdparm -Tt /dev/vg00/lvweb
 Timing cached reads:   21648 MB in  1.99 seconds = 10877.40 MB/sec
 Timing buffered disk reads: 336 MB in  3.02 seconds = 111.37 MB/sec
This entry was posted in Linux, LVM, Storage, Ubuntu. Bookmark the permalink.