Last active
June 22, 2021 13:23
-
-
Save cabecada/c51adac7e1719f4af3c5a5eb2d8ce180 to your computer and use it in GitHub Desktop.
ramfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackpointer.io/unix/linux-create-ram-disk-filesystem/438/ | |
root@db:~# rm -rf /mnt/ramdisk | |
root@db:~# mknod -m 660 /dev/ram0 b 1 0 | |
root@db:~# chown postgres:disk /dev/ram0 | |
root@db:~# mkdir -p /mnt/ramdisk | |
root@db:~# chown -R postgres /mnt/ramdisk | |
root@db:~# mount -t ramfs -o size=128M,maxsize=128M /dev/ram0 /mnt/ramdisk | |
root@db:~# ls -ld /mnt/ramdisk | |
drwxr-xr-x 2 root root 0 Jun 22 18:52 /mnt/ramdisk | |
root@db:~# chown -R postgres /mnt/ramdisk | |
root@db:~# ls -ld /mnt/ramdisk | |
drwxr-xr-x 2 postgres root 0 Jun 22 18:52 /mnt/ramdisk | |
root@db:~# su - postgres | |
postgres@db:~$ cd /mnt/ramdisk | |
postgres@db:/mnt/ramdisk$ initdb -D db | |
The files belonging to this database system will be owned by user "postgres". | |
This user must also own the server process. | |
The database cluster will be initialized with locale "en_US.utf8". | |
The default database encoding has accordingly been set to "UTF8". | |
The default text search configuration will be set to "english". | |
Data page checksums are disabled. | |
creating directory db ... ok | |
creating subdirectories ... ok | |
selecting dynamic shared memory implementation ... posix | |
selecting default max_connections ... 100 | |
selecting default shared_buffers ... 128MB | |
selecting default time zone ... Asia/Kolkata | |
creating configuration files ... ok | |
running bootstrap script ... ok | |
performing post-bootstrap initialization ... ok | |
syncing data to disk ... ok | |
initdb: warning: enabling "trust" authentication for local connections | |
You can change this by editing pg_hba.conf or using the option -A, or | |
--auth-local and --auth-host, the next time you run initdb. | |
Success. You can now start the database server using: | |
pg_ctl -D db -l logfile start | |
postgres@db:/mnt/ramdisk$ pg_ctl -D db -l logfile start | |
waiting for server to start.... done | |
server started | |
postgres@db:/mnt/ramdisk$ psql -c 'select 1' | |
?column? | |
---------- | |
1 | |
(1 row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment