Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Sep 13 '11 at 10:43

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

3  
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
3  
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
add comment

2 Answers

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: http://www.mongodb.org/display/DOCS/Amazon+EC2 –  Roei Sep 13 '11 at 11:35
add comment

Here is a nice tutorial on how to work with fstab

http://www.howtogeek.com/howto/38125/htg-explains-what-is-the-linux-fstab-and-how-does-it-work/

share|improve this answer
    
Thanks, it very helpful to understand the attributes. The thing is that I'm trying to set it as written in mongodb official guide for Amazon EC2 with EBS: http://www.mongodb.org/display/DOCS/Amazon+EC2 –  Roei Sep 13 '11 at 11:39
add comment

Your Answer

 
discard

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.