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!
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:
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.
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.
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
/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.Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.