Score:0

How to store EBS volumes in the database ( using aws ebs as postgresql dataspace)

kz flag
Sam

I have created a Ec2 Amazon linux 2 instance and have attached 4 extra EBS volumes ( gp2=3gb, gp3=3gb,io1=4gb, io2=4gb and mounted it and I have installed postgres db on it.

I have created number of sample tables in the database and made my ebs root volume full to 100%. Now I am creating more table i get the below error:-

** Traceback (most recent call last): File "task15.py", line 12, in cur.execute("INSERT INTO task15 (id , url ,name , city ,description) VALUES ("+str(j)+", 'debian.com','Paul','Europe', 'California' )"); psycopg2.errors.DiskFull: could not extend relation base/16387/16619: No space left on device HINT: Check free disk space. ** This is because I have not mounted the ebs volumes correctly in the database.

I want to know how can i change or move the EBS volumes in the database directory or mount the ebs volumes in the database where my postgres database has been installed. When I do su - postgres (psql) and do show directory the location is:- /usr/local/postgresql/pgsql4/data So when I create more tables the data should be stored ion any of the 4 ebs volumes or only 1 volume out of 4.

Picture

Tim avatar
gp flag
Tim
With EBS you typically get better performance with one large volume than multiple small volumes, though the newer GP3 EBS type has pretty good baseline performance. It could be that you haven't mounted the volumes properly, haven't formatted them, or something else - we don't really have enough information to help.
Sam avatar
kz flag
Sam
I have formatted the mount and mounted it, I want to know how can i mount the volumes in the database, so that wen my root volume is full to 100%, the data will be stored in the other volumes automatically or any 1 of them. @Tim
Tim avatar
gp flag
Tim
You probably need to find a DBA Q&A site for how to configure PostgreSQL. Personally I'd just go into the AWS EC2 console and increase the size of the EBS volume, then reboot the server to have it increase the root volume size. If it doesn't find the extra space automatically you can do it via the command line, AWS will have the command somewhere on their website.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.