1

We have encrypted volume using LUKS.

cryptsetup luksOpen /root/test1 volume1

and mounted on

mount /dev/mapper/volume1 /mnt/files

We created postgres data directory inside /mnt/files and able to start the postgres database.

/usr/local/pgsql/bin/pg_ctl -D /mnt/files/postgres/ -l /var/logs/postgres/postgrs.log  start

Even though we unmounted /mnt/files

sudo umount -l /mnt/files

When we try to close volume using LUKS.

sudo cryptsetup luksClose volume1

Getting following errors:

device-mapper: remove ioctl on volume1 failed: Device or resource busy

user50442
  • 241
  • 1
  • 2
  • 5
  • 1
    So you had a running PostgreSQL on a volume you unmounted? While PostgreSQL can do a recovery on next restart, it's still a bit audacious – and certainly not a good practice on a business environment. – Esa Jokinen May 16 '17 at 07:49

1 Answers1

1

It looks to me like you didn't shut down PostgreSQL before unmounting.

As long as a PostgreSQL process is running, it will have filehandles open. You need to kill them all.

Oh, and BTW, you may have just corrupted your database.

FuzzyChef
  • 161
  • 1
  • 4