Report this

What is the reason for this report?

Ubuntu 22.04 mount point different to fstab after reboot

Posted on June 27, 2023
S Di

By S Di

This is my fstab

LABEL=cloudimg-rootfs   /    ext4   discard,errors=remount-ro   0 1
LABEL=UEFI  /boot/efi   vfat    umask=0077  0 1
/dev/sda    /home/newfolder ext4    defaults    0   0

after a reboot /home/newfolder is replaced by

/dev/sda         50G   16K   47G   1% /mnt/volume_lon1_01

until I umount /dev/sda then df -h shows this

/dev/sda         50G   16K   47G   1% /home/newfolder

How do I get /dev/sda to mount on /home/newfolder on reboot?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Does this happen after every restart? Your /etc/fstab file appears to be set up correctly, but it seems like something else is mounting /dev/sda to /mnt/volume_lon1_01 before the fstab entries are processed.

Do you by any chance have any other services or configurations that are auto-mounting the drive, like systemd, udev, or automount?

Also, does the /home/newfolder exists before the system tries to mount /dev/sda? If the directory doesn’t exist when the system is trying to mount, it will fail.

What I usually do is to run sudo mount -a manually to check if my fstab file has any syntax errors before actually rebooting the server.

Let me know how it goes!

Best,

Bobby

Heya,

The issue you’re facing seems to be that another process or service is mounting your /dev/sda partition to /mnt/volume_lon1_01 at startup before it can be mounted to /home/newfolder as specified in your /etc/fstab.

A few things you could try to solve this:

  1. Check for Cloud-Init or Other Mounting Services: If you’re on a cloud-based server, there might be a configuration in place (such as cloud-init) that mounts volumes at startup. You would need to change this configuration so that /dev/sda is mounted to /home/newfolder instead of /mnt/volume_lon1_01. If you’re using a service like DigitalOcean, you can configure this through the volumes settings.

  2. Use UUID Instead of Device Name: The device name /dev/sda can change based on the order the system detects your drives. Using the UUID of the drive is a more robust method. You can find the UUID by running the command blkid /dev/sda. Replace /dev/sda with UUID=your-uuid in /etc/fstab.

  3. Ensure Correct Syntax in /etc/fstab: Make sure the syntax in your /etc/fstab file is correct. Here’s an example of how your line could look

UUID=your-uuid /home/newfolder ext4 defaults 0 2
  1. Reorder Mounting Points: If /home/newfolder is a subdirectory of another mount point, ensure that it is mounted after that mount point. The order of entries in the /etc/fstab file matters.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.