1

I have an EC2 instance that created on Amazon aws server, with a volume of 8G, and later created another volume of 800G so i could attach to my previous 8G volume. I then created a new filesystem and mounted the 800G volume on /opt/mountpoint directory by using this command

Assuming the new volume is /dev/xvdb:

$ mkfs.ext4 /dev/xvdb
$ mkdir /opt/mountpoint
$ mount /dev/xvdb /opt/mountpoint

At this point, my storage is available at /opt/mountpoint. I need to know how to add this new filesystem to /etc/fstab so that it gets mounted automatically on next boot ?

MadHatter
  • 78,442
  • 20
  • 178
  • 229
Html Tosin
  • 181
  • 1
  • 9
  • @Madhatter, after adding -1, at least you could give a suggestion ! – Html Tosin Oct 28 '13 at 14:48
  • 1
    1) You don't know it was me who downvoted. 2) If you mouseover the "down" arrow, you'll see the text "This questions does not show any research effort; it is unclear or not useful.", and downvotes without comment may be assumed to be for that reason. My suggestion is: do some research. `man fstab` would probably be a good start. – MadHatter Oct 28 '13 at 14:52
  • @Madhatter, Really i see nothing unclear about this question, this question contains the complete step of mounting a new volume after attached, except for the last step "adding it to /etc/fstab/ " which could be of great help to other users. if i haven't made any research...how do u think i even got to this point? – Html Tosin Oct 28 '13 at 15:06
  • 1
    @Madhatter, thks anyway, man fstab was actually a good start! i made my research & got my answers :) – Html Tosin Oct 29 '13 at 13:22

1 Answers1

5

I finally got it fixed & this is how i did it After attaching the volume & running this

$ mkfs.ext4 /dev/xvdb
$ mkdir /opt/mountpoint 
$ mount /dev/xvdb /opt/mountpoint

you'll probably get an error when you run the third command "mount /dev/xvdb /opt/mountpoint", so i read this sshing-into-ec2-server-via-gives-error-please-login-as-the-ec2-user-user-rather

$ sudo su

to become the root user.

And then read this furthermore Mounting an attached ebs volume in EC2 using

$ echo "/dev/xvdb  /opt/mountpoint  ext4     noatime  0 0" >> /etc/fstab

this adds my new filesystem to /etc/fstab

$df -h 

using df -h to view my file system mounted on the EBS volume after reboot

Html Tosin
  • 181
  • 1
  • 9