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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
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 commandblkid /dev/sda
. Replace/dev/sda
withUUID=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/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.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 thefstab
entries are processed.Do you by any chance have any other services or configurations that are auto-mounting the drive, like
systemd
,udev
, orautomount
?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 myfstab
file has any syntax errors before actually rebooting the server.Let me know how it goes!
Best,
Bobby