QNAP USB external 3tb drive does not work

This is because you must use parted instead of fdisk to format the drive.


parted /dev/sdta

(parted) mklabel gpt
mklabel gpt
Warning: The existing disk label on /dev/sdta will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes
yes

(parted) mkpart primary 0 -1
mkpart primary 0 -1
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ignore
ignore

(parted) quit
quit

mke2fs -m1 -t ext4 /dev/sdtb1

mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
183148544 inodes, 732566637 blocks
7325666 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
22357 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group

Posted in Linux | Comments Off on QNAP USB external 3tb drive does not work

How to fix postgres sequences that are causing integrity errors.

Save this to a sql file:

SELECT 'SELECT SETVAL(' ||quote_literal(quote_ident(S.relname))|| ', MAX(' ||quote_ident(C.attname)|| ')+1) FROM ' ||quote_ident(T.relname)|| ';'
FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C
WHERE S.relkind = 'S'
AND S.oid = D.objid
AND D.refobjid = T.oid
AND D.refobjid = C.attrelid
AND D.refobjsubid = C.attnum
ORDER BY S.relname;

run the sql file like this:

psql -Atq my_database < reset.sql > tmp.sql
psql my_database < tmp.sql

Posted in postgres | Comments Off on How to fix postgres sequences that are causing integrity errors.

How to see currently executing queries in postgres 9.2

SELECT query,xact_start,query_start FROM pg_stat_activity;

Posted in postgres | Comments Off on How to see currently executing queries in postgres 9.2

Force a URL to HTTPS using Kemp Loadmaster and Nginx

On the Kemp Loadmaster, do a request header modification, adding the HTTPS: on header.

  • View/Modify Services
  • Click the “Modify” button on  your port 443 service you have already set up
  • Under Advanced Properties,  click Show Header Rules under HTTP Header Modifications
  • Click Add  on “Add Header: HTTPS” under Request Rules

Now in your backend app or webserver you need to check for that header.  In nginx you can do this:


location /admin/ {
if ($http_https != on) {
return 301 https://www.tacmedsolutions.com$request_uri;
}
proxy_set_header host www.boxtricks.com;
proxy_pass http://127.0.0.1:8000;
}

Posted in Kemp, Linux, nginx | Comments Off on Force a URL to HTTPS using Kemp Loadmaster and Nginx

git push error: RPC failed; result=22, HTTP code = 411

When doing a git push, I was getting the following error.

error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly

This fixed it:

git config http.postBuffer 524288000

Posted in git, Linux | Comments Off on git push error: RPC failed; result=22, HTTP code = 411