1. MagicESP
  2. Ubuntu Server 22.04
  3. Ubuntu Server Format Disk and Mount Disk

Ubuntu Server Format Disk and Mount Disk

Please be careful modify /etc/fstab file.

List Disks

lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT

format disk by device

sudo mkfs.ext4 {{ device.value }}
# more inode for many many files
sudo mkfs.ext4 -i 2048 {{ device.value }}

mount disk using device name

sudo {{ texteditor.value }} /etc/fstab

add this line

{{ device.value }}  {{ mountpath.value }} ext4  {{ mount_option.value }}  0  0

or using this one line command

echo '{{ device.value }}  {{ mountpath.value }} ext4  {{ mount_option.value }}  0  0' | sudo tee -a /etc/fstab

mount now and check

sudo mkdir -p {{ mountpath.value }}
sudo mount -a
df -h -x devtmpfs -x tmpfs

mount disk using UUID

sudo blkid

find out your device UUID

sudo {{ texteditor.value }} /etc/fstab

add this line

UUID={{ uuid.value }}  {{ mountpath.value }} ext4  {{ mount_option.value }}  0  0

or using this one line command

echo 'UUID={{ uuid.value }}  {{ mountpath.value }} ext4  {{ mount_option.value }}  0  0' | sudo tee -a /etc/fstab

mount now and check

sudo mkdir -p {{ mountpath.value }}
sudo mount -a
df -h -x devtmpfs -x tmpfs

If there are many many files in the path

/etc/cron.daily/mlocate can slow down the system if there are too many files in the path {{ mountpath.value }}.

sudo {{ texteditor.value }} /etc/updatedb.conf

add the raid path to PRUNEPATHS

PRUNEPATHS="/tmp /var/spool /media /home/.ecryptfs /var/lib/schroot {{ mountpath.value }}"

Linux Question: When does updatedb.mlocat / cron.daily run?