Ubuntu

Add Storage

Here we will add a new hard drive for independent storage and mount it to the system this could be used for samba share. This will be done on Ubuntu Linux current version is 22.04.02. The latest version can be downloaded from their website https://ubuntu.com/download/server.I have added a 450G hard disk to the system. Now we will create a partition and mount it to a directory on the system. We will also add the disk to fstab so it will auto mount on restart. I have SSH’d into the server so I need to open the SSH port before enabling the universal fire wall from fresh install.

# sudo ufw allow 22/tcp
# sudo ufw enable

Update server.

# sudo apt update && apt upgrade

Find the new drive names and the volume group name and the logic volume name.

# sudo lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1.8G 0 part /boot
└─sda3 8:3 0 18.2G 0 part
└─ubuntu–vg-ubuntu–lv 253:0 0 918.2G 0 lvm /
sdb 8:16 0 450G 0 disk
└─ubuntu–vg-ubuntu–lv 253:0 0 918.2G 0 lvm /
sdc 8:32 0 450G 0 disk
└─ubuntu–vg-ubuntu–lv 253:0 0 918.2G 0 lvm /
sdd 8:48 0 450G 0 disk <—– this is the disk name we are adding sdd
sr0 11:0 1 1024M 0 rom

Create partition on /dev/sdd.

# sudo fdisk /dev/sdd
	: g     <----- convert to GPT
	: n     <----- new partition follow prompts
	: w     <----- write to system

Check new partition. There should now be a sdd1

# sudo lsblk -p /dev/sdd

Format new partition.

# sudo mkfs -t ext4 /dev/sdd1

Create directory to mount the new partition. I will use share and place it in /mnt the mount folder for more permanent storage.

# sudo mkdir /mnt/share

Mount new partition.

# sudo mount /dev/sdd1 /mnt/share

Check mounted ok. You should now be able to see /mnt/share

# sudo lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1.8G 0 part /boot
└─sda3 8:3 0 18.2G 0 part
└─ubuntu–vg-ubuntu–lv 253:0 0 918.2G 0 lvm /
sdb 8:16 0 450G 0 disk
└─ubuntu–vg-ubuntu–lv 253:0 0 918.2G 0 lvm /
sdc 8:32 0 450G 0 disk
└─ubuntu–vg-ubuntu–lv 253:0 0 918.2G 0 lvm /
sdd 8:48 0 450G 0 disk
└─sdd1 8:49 0 450G 0 part /mnt/share <—– can now see it’s mounted at /mnt/share
sr0 11:0 1 1024M 0 rom

Mount permanently on restart etc. First find the unique id UUID.

# sudo blkid

/dev/mapper/ubuntu–vg-ubuntu–lv: UUID=”8ce6d827-b178-4f7f-a0a5-7a0e2aed665f” BLOCK_SIZE=”4096″ TYPE=”ext4″
/dev/sda2: UUID=”dfa8d1be-fb11-4571-96a2-3491e24c8d25″ BLOCK_SIZE=”4096″ TYPE=”ext4″ PARTUUID=”2f5376d6-9338-4390-8616-55dcb4b82f5d”
/dev/sda3: UUID=”6rOmjN-pAIs-K4cz-SxMI-oRCZ-MxWV-dbLkbH” TYPE=”LVM2_member” PARTUUID=”10be40e3-8830-471b-ab6c-1e21f96053e0″
/dev/loop1: TYPE=”squashfs”
/dev/sdd1: UUID=”4e07bf22-7a7d-4d15-b77a-070ef94730c1” BLOCK_SIZE=”4096″ TYPE=”ext4″ PARTUUID=”dd5f86b1-6b34-c64d-8569-265785a9f6f7″ <—–
/dev/sdb: UUID=”UNDV94-RVD5-QofK-JKpG-PniZ-wvMh-YlqLT0″ TYPE=”LVM2_member”
/dev/loop6: TYPE=”squashfs”
/dev/loop4: TYPE=”squashfs”
/dev/loop2: TYPE=”squashfs”
/dev/loop0: TYPE=”squashfs”
/dev/sdc: UUID=”zkuQSz-9pA6-ixq2-f0dq-Tj85-z3kU-rdUFvC” TYPE=”LVM2_member”
/dev/sda1: PARTUUID=”e8f2519d-d1fa-4926-a29a-a0e82369bb05″
/dev/loop5: TYPE=”squashfs”
/dev/loop3: TYPE=”squashfs”

# sudo vi /etc/fstab

Add following line.

UUID=4e07bf22-7a7d-4d15-b77a-070ef94730c1 /mnt/share/ ext4 defaults 0 0

Check by forcing mount now.

# sudo mount -a
Scroll to Top