• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

restore

Saving and Restoring iptables

September 22, 2022

iptables can be saved or loaded from a file. Here’s a way to do it.

Saving to a file

# Debian/Ubuntu
iptables-save > /etc/iptables/rules.v4
# Redhat/Centos/Rocky
iptables-save > /etc/sysconfig/iptables

# Debian/Ubuntu iptables-save > /etc/iptables/rules.v4 # Redhat/Centos/Rocky iptables-save > /etc/sysconfig/iptables

Loading from a file

# Debian/Ubuntu
iptables-restore > /etc/iptables/rules.v4
# Redhat/Centos/Rocky
iptables-restore > /etc/sysconfig/iptables

# Debian/Ubuntu iptables-restore > /etc/iptables/rules.v4 # Redhat/Centos/Rocky iptables-restore > /etc/sysconfig/iptables

Listing rules

iptables -L

iptables -L

Filed Under: Linux Tagged With: iptables, list, restore, save

Winbind Fix

May 24, 2021

Here’s the process to restore Winbind.

Restore old config.

cp /etc/sssd/sssd.conf-xxxxxxx /etc/sssd/sssd.conf
cp /etc/krb5.conf-xxxxxxx /etc/krb5.conf

cp /etc/sssd/sssd.conf-xxxxxxx /etc/sssd/sssd.conf cp /etc/krb5.conf-xxxxxxx /etc/krb5.conf

Disable SSSD. Authconfig creates /etc/nswitch.conf.

authconfig --disablesssd --disablesssdauth --updateall

authconfig --disablesssd --disablesssdauth --updateall

Start Winbind.

service winbind start; service smb start; service nmb start

service winbind start; service smb start; service nmb start

Filed Under: Linux Tagged With: disable, restart, restore, winbind

EFS Encryption

December 3, 2020

If you have an existing EFS that’s unencrypted, you can encrypt it be creating a snapshot using AWS Backup, and then restoring the file system to a new EFS with encryption. If you choose to restore in a directory in the same file system, it will not be encrypted. It has to be a new EFS. In addition, you’ll be asked to select which encryption key to use. The default key will work, unless you have your own.

Filed Under: Cloud Tagged With: aws, backup, efs, encryption, key, restore, unencrypted

MySQL Restore to another DB

June 14, 2020

In order to restore a MySQL database to another database, use routines and triggers.

mysqldump -p user -p --routines --triggers db1 > db1.sql

mysqldump -p user -p --routines --triggers db1 > db1.sql

To restore to another database, just use the normal command.

mysql -u user -p db2 < db1.sql

mysql -u user -p db2 < db1.sql

Filed Under: Linux Tagged With: another, database, mysql, mysqldump, restore, routines, triggers

MySQL Restore

April 26, 2020

Here’s how to restore a MySQL database from mysqldump.

mysql -u user -p
mysql> drop database databasename;
mysql> quit;
Bye
mysql -u user -p databasename < filename.sql

mysql -u user -p mysql> drop database databasename; mysql> quit; Bye mysql -u user -p databasename < filename.sql

Drop database first, then import the SQL file.

Filed Under: Linux Tagged With: import, mysql, restore, sql

GCP Convert Standard to SSD

August 20, 2019

How to convert Persistent Standard disk to SSD.

First create a snapshot of the disk.

gcloud compute disks snapshot your-server \
--snapshot-names manual-snapshot-disk-1 \
--project your-project \
--zone us-central1-c

gcloud compute disks snapshot your-server \ --snapshot-names manual-snapshot-disk-1 \ --project your-project \ --zone us-central1-c

Restore snapshot to SSD format.

gcloud compute disks create disk-1-ssd \
--source-snapshot manual-snapshot-disk-1 \
--project your-project \
--zone us-central1-a \
--type pd-ssd \
--size 10GB

gcloud compute disks create disk-1-ssd \ --source-snapshot manual-snapshot-disk-1 \ --project your-project \ --zone us-central1-a \ --type pd-ssd \ --size 10GB

Swap disks using GCP attach and detach.

Filed Under: Cloud Tagged With: create, disk, gcp, restore, snapshot, ssd

AWS CLI Restore Object from S3 Glacier

June 26, 2019

How to restore an object from Amazon S3 Glacier via the AWS CLI.

aws s3api restore-object \
--bucket awsexamplebucket \
--key dir1/example.obj \
--restore-request '{"Days":25,"GlacierJobParameters":{"Tier":"Standard"}}'

aws s3api restore-object \ --bucket awsexamplebucket \ --key dir1/example.obj \ --restore-request '{"Days":25,"GlacierJobParameters":{"Tier":"Standard"}}'

Filed Under: Cloud Tagged With: aws, cli, glacier, object, restore, s3

GCP Restore

June 16, 2019

How to restore from GCP Snapshots. Let’s say you have an instance called webserver with 2 disks.

Restore from snapshots:

gcloud compute disks create webserver-boot-r \
--project=your-project \
--source-snapshot=webserver-boot-190616 \
--zone=us-central1-a
gcloud compute disks create webserver-data-r \
--project=your-project \
--source-snapshot=webserver-data-190616 \
--zone=us-central1-a

gcloud compute disks create webserver-boot-r \ --project=your-project \ --source-snapshot=webserver-boot-190616 \ --zone=us-central1-a gcloud compute disks create webserver-data-r \ --project=your-project \ --source-snapshot=webserver-data-190616 \ --zone=us-central1-a

Stop instance. Detach and attach disks:

gcloud compute instances detach-disk webserver --disk=webserver-boot --zone us-central1-a
gcloud compute instances attach-disk webserver --disk=webserver-boot-r --zone us-central1-a --boot
gcloud compute instances detach-disk webserver --disk=webserver-data --zone us-central1-a
gcloud compute instances attach-disk webserver --disk=webserver-data-r --zone us-central1-a

gcloud compute instances detach-disk webserver --disk=webserver-boot --zone us-central1-a gcloud compute instances attach-disk webserver --disk=webserver-boot-r --zone us-central1-a --boot gcloud compute instances detach-disk webserver --disk=webserver-data --zone us-central1-a gcloud compute instances attach-disk webserver --disk=webserver-data-r --zone us-central1-a

Boot instance.

Filed Under: Cloud Tagged With: disks, gcp, restore, snapshots

  • Home
  • About
  • Archives

Copyright © 2023