2

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?

4
  • 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, 2011 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, 2011 at 9:37
  • Yes, I use sudo. I didn't know nano, it helped me for editing the file, thanks!
    – Roei
    Sep 13, 2011 at 11:14
  • What do dmesg show? (And what Linux system are you using?)
    – Diblo Dk
    Jul 7, 2013 at 13:00

1 Answer 1

1

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

2
  • 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, 2011 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, 2011 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .