Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I mount a device mount /dev/xvdf /mnt/mongo and verify the mount using df-h:

Filesystem            Size  Used Avail Use% Mounted on  
/dev/xvda1            7.9G  955M  6.9G  12% /  
tmpfs                 299M   44K  299M   1% /dev/shm  
/dev/xvdf              20G  589M   19G   4% /mnt/mongo  

But now I'm trying to figure out how to make it auto mount on boot.

I understand I need to add a new entry to /etc/fstab, so I perform:

$ sed -i '$ a\/dev/xvdf /mnt/mongo xfs defaults 1 1' /etc/fstab

But, after reboot, it seems that the auto mount didn't work. The device didn't appear in the df -h list.

Should I not use the sed to add the entry? Is the entry I entered incorrect?

share|improve this question

migrated from Sep 13 '11 at 10:43

This question came from our site for professional and enthusiast programmers.

What distribution are you using? Stupid question but did you use sudo? Also the question is probably best directed at the *nix Q&A Forum – Ali Sep 13 '11 at 9:30
the easier way would be to edit the file directly with nano /etc/fstab as root, or sudo nano /etc/fstab if sudo is enabled or if you are using ubuntu. – Carlos Campderrós Sep 13 '11 at 9:37
Yes, I use sudo. I didn't know nano, it helped me for editing the file, thanks! – Roei Sep 13 '11 at 11:14
What do dmesg show? (And what Linux system are you using?) – Diblo Dk Jul 7 '13 at 13:00

Sed is fine, but not ideal for what you're doing. Sed is more for when you just want a user to paste something to the terminal. Like the comments said, you can edit the file using nano or if you prefer the GUI you can use gedit, kate, or whatever your preferred editor is.

To get the filesystem to mount at boot, under the options field you want "auto" So your line should look like /dev/xvdf /mnt/mongo xfs defaults,auto 1 1

share|improve this answer
I changed my entry to: /dev/xvdf /mnt/mongo xfs defaults,auto,noatime,noexec,nodiratime 0 0 and reboot, and still - it didn't auto mounted the device. I'm using Amazon EBS device, does it matter? – Roei Sep 13 '11 at 11:16
I used these settings, as written in the official mongodb docs for linux with ebs: – Roei Sep 13 '11 at 11:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.