środa, 13 czerwca 2012

Polecenia OpenSSL

LINK

Polecenia OpenSSL

Generowanie klucza prywatnego z hasłem

Hasło będzie należało podać podczas startowania serwera.
openssl genrsa -des3 -out mojadomena.key 2048

Generowanie klucza prywatnego bez hasła

Potencjalnie niebezpieczne, ale umożliwi wystartowanie serwera bez podawania hasła.
openssl genrsa -out mojadomena.key 2048

Usunięcie hasła z klucza prywatnego

openssl rsa -in mojadomena.key -out mojadomena.bezhasla.key

Generowanie CSR

Wpisz poniższe polecenie, aby wygenerować CSR wg prywatnego klucza RSA. (w formacie PEM). Zakładamy, że plik CSR będzie nosił nazwę mojadomena.csr.
openssl req -new -key mojadomena.key -out mojadomena.csr
Przykładowa zawartość pliku CSR:
-----BEGIN NEW CERTIFICATE REQUEST-----
MIIDCjCCAnMCAQAwdTEZMBcGA1UEAxMQaG9zdC5kb21haW4ubmFtZTEVM
BMGA1UECxMMT3JnYW5pemF0aW9uMRUwEwYDVQQKEwxPcmdhbml6YXRpb2
Vnq2AWTDw2ykyxKg6neb2vYTZRvbot7M578Vvh6P8CAwEAAaCCAVMwGgY
KKwYBBAGCNw0CAzEMFgo1LjAuMjE5NS4yMDUGCisGAQQBgjcCAQ4xJzAl
MA4GA1UdDwEB/wQEAwIE8DATBgNVHSUEDDAKBggrBgEFBQcDATCB/QYKK
IhvcNAQEFBQADgYEAg4+QHTvkP5CG+WcGnrhKiMkJnMP6QEsds40obUDS
dGtEupQz8C+4xoMd1aM68q9Ri6Va+JTeuhKHxLz9hT/KUJhNBy0sRfnx+
JkQdrKG69UanTwvLqXINh9xChw9ErIto/2kZI5kl2KYQdiOqTv6p0GEUP
Rq/MD52Zy3bOzSRF0=
-----END NEW CERTIFICATE REQUEST-----
Szczegółowe informacje na temat generowania CSR.

Weryfikacja klucza prywatnego

openssl rsa -in mojadomena.key -check

Weryfikacja pliku CSR

openssl req -noout -text -in mojadomena.csr
lub
openssl req -noout -verify -in mojadomena.csr

Weryfikacja certyfikatu SSL

openssl x509 -noout -text -in mojadomena.pem

Weryfikacja sum kontrolnych certyfikatu i klucza prywatnego

Poniższe polecenia umożliwiają porównanie sum kontrolnych certyfikatu i klucza prywatnego. Jeżeli wynik działania obu poleceń jest identyczny, oznacza to, iż klucz prywatny pasuje do certyfikatu SSL.

Sprawdzenie sumy kontrolnej klucza prywatnego:

openssl rsa -in mojadomena.key -modulus -noout | openssl md5
Przykładowy wynik działania:
ccd4ca8dc071f3a61b580b7e7427a7cf

Sprawdzenie sumy kontrolnej certyfikatu SSL:

openssl x509 -in mojadomena.pem -modulus -noout | openssl md5
Przykładowy wynik działania:
ccd4ca8dc071f3a61b580b7e7427a7cf

Weryfikacja certyfikatu i CA

Gdzie cacert.pem to plik pobrany z serwera wystawcy.
openssl verify -verbose -CAfile cacert.pem mojadomena.pem

Wygenerowanie CSR-a na podstawie istniejącego certyfikatu SSL

openssl x509 -x509toreq -in mojadomena.pem -out mojadomena.csr -signkey mojadomena.key

Konwersja klucza prywatnego z formatu PEM do DER

openssl rsa -inform PEM -in mojadomena.pem -outform DER -out mojadomena.der

Konwersja klucza prywatnego z formatu DER do PEM

openssl rsa -inform DER -in mojadomena.der -outform PEM -out mojadomena.pem

Konwersja certyfikatu i klucza prywatnego z Apache'a do zaimportowania w IIS na serwerze Windows (z formatu PEM do PKCS#12).

Poniższe polecenie utworzy kopię zapasową certyfikatu, klucza prywatnego i certyfikatów pośrednich w pliku iis.pfx w formacie PKCS#12.
openssl pkcs12 -export -inkey mojadomena.key -in mojadomena.pem -certfile intermediate.pem -out iis.pfx

Konwersja certyfikatu z formatu PEM do PKCS#7 (P7B).

Poniższe polecenie utworzy kopię zapasową certyfikatu serwera i certyfikatu pośredniego w pliku mojadomena.pfx w formacie PKCS#7.
openssl crl2pkcs7 -nocrl -certfile mojadomena.pem -out mojadomena.p7b -certfile certyfikat_posredni.cer

Konwersja certyfikatu i klucza prywatnego z IIS-a do Apache'a lub innego serwera (z formatu PKCS#12 do PEM).


Przeniesienia certyfikatu

Poniższe polecenie utworzy plik mojadomena.pem zawierający certyfikat.
openssl pkcs12 -in iis.pfx -clcerts -nokeys -out mojadomena.pem

Przeniesienia klucza prywatnego

Poniższe polecenie utworzy plik mojadomena.key z kluczem prywatnym zabezpieczonym hasłem.
openssl pkcs12 -in iis.pfx -nocerts -out mojadomena.key
Poniższe polecenie utworzy plik mojadomena.key z kluczem prywatnym bez hasła
openssl pkcs12 -in iis.pfx -nocerts -nodes -out mojadomena.key

Sprawdzenie poprawności instalacji certyfikatu SSL na serwerze

root_ca.cer - plik z certyfikatem Root CA dla właściwego certyfikatu
www.moja-domena.pl:443 - adres serwera oraz port (443 - domyślny dla połączeń HTTPS)
Wersja skrócona

openssl s_client -CAfile root_ca.cer -quiet -connect www.moja-domena.pl:443
Przykładowy wynik działania powyższego polecenia
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify return:1
depth=1 C = US, O = "GeoTrust, Inc.", CN = RapidSSL CA
verify return:1
depth=0 serialNumber = gas3S67znrMS0G-Ak1BxcG0zb6RTNpBx, C = PL, O = www.moja-domena.pl, OU = GT985185119, OU = See www.rapidssl.com/resources/cps (c)10, OU = Domain Control Validated - RapidSSL(R), CN = www.moja-domena.pl
verify return:1

Wersja rozszerzona

openssl s_client -CAfile root_ca.cer -connect www.moja-domena.pl:443
Przykładowy wynik działania powyższego polecenia
CONNECTED(00000003)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify return:1
depth=1 C = US, O = "GeoTrust, Inc.", CN = RapidSSL CA
verify return:1
depth=0 serialNumber = gas3S67znrMS0G-Ak1BxcG0zb6RTNpBx, C = PL, O = www.moja-domena.pl, OU = GT985185119, OU = See www.rapidssl.com/resources/cps (c)10, OU = Domain Control Validated - RapidSSL(R), CN = www.moja-domena.pl
verify return:1
---
Certificate chain
0 s:/serialNumber=gas3T67enrMS0G-Ak1BxcG0zs6RTNpBx/C=PL/O=www-moja-domena.pl/OU=GT90180134/OU=See www.rapidssl.com/resources/cps (c)10/OU=Domain Control Validated - RapidSSL(R)/CN=www.moja-domena.pl
i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
1 s:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIE2TCCA8GgAwIBAgICAUAwDQYJKoZIhvcNAQEFBQAwPDELMAkGA1UEBhMCVVMx
FzAVBgNVBAoTDkdlb1RydXN0LCBJbmMuMRQwEgYDVQQDEwtSYXBpZFNTTCBDQTAe
Fw0xMDEyMDgxNDQ5NDBaFw0xMTExMTQxOTA2MDZaMIHtMSkwJwYDVQQFEyBnYXMz
VDY3ZW5yTVMwRy1BazFCeGNHMHpzNlJUTnBCeDELMAkGA1UEBhMCUEwxHDAaBgNV
BAoTE3JhcGlkc3NsLmdpZ2FvbmUucGwxEzARBgNVBAsTCkdUOTAxODAxMzQxMTAv
BgNVBAsTKFNlZSB3d3cucmFwaWRzc2wuY29tL3Jlc291cmNlcy9jcHMgKGMpMTAx
LzAtBgNVBAsTJkRvbWFpbiBDb250cm9sIFZhbGlkYXRlZCAtIFJhcGlkU1NMKFIp
MRwwGgYDVQQDExNyYXBpZHNzbC5naWdhb25lLnBsMIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEArLaestflJoCOIaRwYk5P4eH6wz/I3tHZcwB+fkfbPiuZ
D2TuMdMxGIsVlES/YbQ6dYmbjVFFGQOl9lcX1K4LoDfByVH2W9jH729KKZ05hLWE
6gHiAzkDEsEnxEX8eh+B0NuIHBAbgGgg2gu2D8jamf95tpd3NKnZJ5VFdhRAMwS4
Wihz06KpXadFTnk6Ra4Vo2Qkd8va+UW1aJlk3Qz1uWZonY4DN5aWtBqigCXYfW/k
urYIUnkt0IYWB8xPfl54NtRCnEpSkoAgo2JY3+zjw87Ytuo2aiwFReQwC+4ogD/O
ZiFWwf9ZYBZoTHcQW0/RDdptvUmnkuGcZtclw46CKwIDAQABo4IBMTCCAS0wHwYD
VR0jBBgwFoAUa2k9ahhCSt2PAmU5/TUkhniRFjAwDgYDVR0PAQH/BAQDAgWgMB0G
A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAeBgNVHREEFzAVghNyYXBpZHNz
bC5naWdhb25lLnBsMEMGA1UdHwQ8MDowOKA2oDSGMmh0dHA6Ly9yYXBpZHNzbC1j
cmwuZ2VvdHJ1c3QuY29tL2NybHMvcmFwaWRzc2wuY3JsMB0GA1UdDgQWBBSOQy0O
ebxt/rc1Xlb+zc05dRQygzAMBgNVHRMBAf8EAjAAMEkGCCsGAQUFBwEBBD0wOzA5
BggrBgEFBQcwAoYtaHR0cDovL3JhcGlkc3NsLWFpYS5nZW90cnVzdC5jb20vcmFw
aWRzc2wuY3J0MA0GCSqGSIb3DQEBBQUAA4IBAQBFbkwLXqTdNn/H1MrF7Uhnb8xg
vzquhcOdKrdBmLBLK2O8VNveTwEIe+sJMpb0M+ozjhacbA4c7Amj4Y9ZFHS1UA4B
y56fRr634TOCO+fgUX/H7Xr1dc9tKM9b8s7Tb82V/NkWD7YaRbBS4AUWDW+y31/Q
IUXn98OmuI3SEvEivqGiSaq1aEEjUzC8m6xY/WT/KKg/bC+3b71R5GeWpli5XroO
SU11e7kE+WSCstRSopJzqeDxmuL1NdpfMiDnu4GvrC0ybORd96RxdqBQbe0RSbnE
Fjkv8GyzBh9N8k373v9CFh5dPYrzGylNo+ysCChqPPRYws60zJqkfs6BVkhf
-----END CERTIFICATE-----
subject=/serialNumber=gas3S67znrMS0G-Ak1BxcG0zb6RTNpBx/C=PL/O=www.moja-domena.pl/OU=GT90180134/OU=See www.rapidssl.com/resources/cps (c)10/OU=Domain Control Validated - RapidSSL(R)/CN=www.moja-domena.pl
issuer=/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
---
No client certificate CA names sent
---
SSL handshake has read 3938 bytes and written 409 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: zlib compression
Expansion: zlib compression
SSL-Session:
Protocol : TLSv1
Cipher : DHE-RSA-AES256-SHA
Session-ID: 1F3AFADC347E7743904615AA175962936D9E36335CCCDDF2C658E986E31A553F
Session-ID-ctx:
Master-Key: 467AA14A3CA9FB415F67CB7B7C6F0DC66ABE9075E0DF11F14126F26D32EBBFE814A397503782DBF29AF54CEDE4DCBCD1
Key-Arg : None
PSK identity: None
PSK identity hint: None
TLS session ticket:
0000 - e3 66 0c 65 55 1c aa ea-61 b7 32 2b f3 13 75 8d .f.eU...a.2+..u.
0010 - 69 0e d0 18 f2 35 8e 5c-11 27 fa c5 67 4f 0b d9 i....5.\.'..gO..
0020 - 9d 7f ab 75 aa 90 4f 57-ba d6 b8 7e 28 45 3d 97 ...u..OW...~(E=.
0030 - 35 84 15 f1 0a 4c 2e c7-e9 ed 8a f9 bb 44 c8 ca 5....L.......D..
0040 - 9d 72 59 71 28 07 b3 e2-10 57 db cb 07 32 7f cb .rYq(....S...2..
0050 - b7 46 db a2 d9 8b 01 6e-20 ca 13 36 19 63 11 e2 .F.....n ..6.c..
0060 - 64 70 e1 32 42 fd 3f 3f-1a 49 e9 ea f0 51 a9 66 dp.2B.??.I...Q.f
0070 - bb dd d8 a2 52 8a df 8f-a6 d6 62 60 dd 53 54 5b ....R.....b`.ST[
0080 - 26 31 47 25 73 5b 7e 67-d6 52 36 94 7b a9 aa 97 x1G%s[~g.R6.....
0090 - 6b 82 1d 60 ca 6a e4 a4-0b 3c d5 33 b5 82 a7 a1 k..`.j.....3....

Compression: 1 (zlib compression)
Start Time: 1302325519
Timeout : 300 (sec)
Verify return code: 0 (ok)
---

piątek, 8 czerwca 2012

GNOME fallback 2

LINK

Now, the part that really interests us. Go to System Settings > System Info. In this window, you'll be able to activate - force - Fallback Mode. The next time you login, you'll enjoy a more mainstream interface you're familiar with from the Gnome 2.X generation.

GNOME fallback

Przełączenie do starego trybu
LINK

Change Default Session from gnome to gnome-fallback
Thread Tools
Display
12-Sep-2011, 10:33 #1 ryanrio95
Newcomer


Join Date
Aug 2011
Posts
34
Change Default Session from gnome to gnome-fallback
Does anyone knows how to do this for all users with one command?
Or which file i have to edit to do this?

Regards, Ryan.
Reply With Quote
12-Sep-2011, 10:58 #2 please_try_again
Flux Capacitor Penguin


Join Date
Sep 2008
Posts
7,577
Re: Change Default Session from gnome to gnome-fallback
I wrote a script which doses that - among other things:

compositor: quickly sets/unsets compositing (helps with fullscreen Flash on ATI)

To switch from gnome to gnome-fallback, just type the following and restart Gnome:
Code:
compositor
To switch from gnome-fallback to gnome: Just type:
Code:
compositor gnome3
If you type
Code:
compositor
while in gnome-fallback, it switches compositing on/off.

This script in also included in the package conkyconf, available in my repo (has little to do with conky though): Easy configuring conky with conkyconf.
Reply With Quote
12-Sep-2011, 12:11 #3 malcolmlewis
Global Moderator


Join Date
Jun 2008
Location
Podunk
Posts
11,708
Blog Entries
13
Re: Change Default Session from gnome to gnome-fallback
Originally Posted by ryanrio95
Does anyone knows how to do this for all users with one command?
Or which file i have to edit to do this?

Regards, Ryan.
Hi
Under System Settings -> Graphics Forced Fallback Mode on, or;
Code:
gsettings set org.gnome.desktop.session session-name gnome-fallback
--
Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.4 (x86_64) Kernel 2.6.37.6-0.7-desktop
up 6 days 17:38, 5 users, load average: 0.16, 0.13, 0.27
GPU GeForce 8600 GTS Silent - Driver Version: 280.13

Reply With Quote
12-Sep-2011, 12:12 #4 ryanrio95
Newcomer


Join Date
Aug 2011
Posts
34
Re: Change Default Session from gnome to gnome-fallback
isn't there an command in opensuse that can do this? for the whole system?
Reply With Quote
12-Sep-2011, 12:16 #5 please_try_again
Flux Capacitor Penguin


Join Date
Sep 2008
Posts
7,577
Re: Change Default Session from gnome to gnome-fallback
Originally Posted by ryanrio95
isn't there an command in opensuse that can do this? for the whole system?
Yes, the command I use in the script. Otherwise, you can click on System Info -> Graphics -> Forced Fallback mode: ON ... if you can find it.
Reply With Quote
12-Sep-2011, 12:22 #6 ryanrio95
Newcomer


Join Date
Aug 2011
Posts
34
Re: Change Default Session from gnome to gnome-fallback
but this only changes it for one user. can it be changed on the whole system?
Reply With Quote
12-Sep-2011, 12:59 #7 ryanrio95
Newcomer


Join Date
Aug 2011
Posts
34
Re: Change Default Session from gnome to gnome-fallback
i think there is a file in /etc/ or something that contains the default gnome session, which i'am able to edit?
Reply With Quote
12-Sep-2011, 13:41 #8 please_try_again
Flux Capacitor Penguin


Join Date
Sep 2008
Posts
7,577
Re: Change Default Session from gnome to gnome-fallback
Originally Posted by ryanrio95
i think there is a file in /etc/ or something that contains the default gnome session, which i'am able to edit?
You can try to edit /usr/share/xsessions/gnome.desktop (or whatever this file is called, as I'm not using the default sessions) and use the following values for Exec and TryExec in this file:
Code:
Exec=gnome-session --session=gnome-fallback
TryExec=gnome-session --session=gnome-fallback
Please report if it works.
Reply With Quote
13-Sep-2011, 08:57 #9 ryanrio95
Newcomer


Join Date
Aug 2011
Posts
34
Re: Change Default Session from gnome to gnome-fallback
No,this just removes the Gnome option from the login screen.
But i really like this type of idea.
Reply With Quote
13-Sep-2011, 10:04 #10 please_try_again
Flux Capacitor Penguin


Join Date
Sep 2008
Posts
7,577
Re: Change Default Session from gnome to gnome-fallback
If you disable 3D rendering, you won't be able to use gnome-shell (but you won't be able to do some other things as well).
Adding this to /etc/X11/xorg.conf did the trick on Fedora (I don't have Gnome3 on openSUSE yet):

Code:
Section "Module"
Disable "glx"
EndSection
If that doesn't work, another even worse hack would be to rename /usr/lib64/xorg/modules/extensions/libglx.so (or /usr/lib/xorg/modules/extensions/libglx.so) on 32bit systems. But really, the cleanest and fastest way to switch from gnome to gnome-fallback (and vice-versa) is probably to use compositor at a user level. I needed to do so and this is one of the reason why I wrote this script (that I'm going to update pretty soon btw). It's not a big deal for users to type "compositor" once.

Gnome3 is not fun because it now uses a binary config file - simply unacceptable IMO under Linux or Unix. My guess is that the kids who developed Gnome3 must have learned to programm under WIndows. I might miss the point but I can't see any good reason not to use a configuration which is readable an parsable with basic Unix tools. If you have to set up Gnome3 in fallback mode for hundreds of users, you can try to set it up once and copy ~/.config/dfconf/user to /etc/skel/.config/dconf/user. so that each new user you create would default to gnome-fallback (I haven't tried though but I have this file in my skeleton for other settings than gnome-fallback). Another possibility is to use this command in one of the X startup scripts, executed by the user (not root), such as the Xsession script:

Code:
gsettings set org.gnome.desktop.session session-name gnome-fallback
I'm surprised that the --session option didn't work.

środa, 6 czerwca 2012

LVM2: vgscan fails to recreate lvmtab

LINK

I recently moved an LVM array from one server to another. When I tried to recreate the lvmtab with pvscan/vgscan, it successfully found my 3 disks, but do not recreate lvm tab.

# pvscan -v
Wiping cache of LVM-capable devices
Wiping internal VG cache
Walking through all physical volumes
PV /dev/sdb1 VG vg0 lvm2 [4.00 GiB / 0 free]
PV /dev/sdc1 VG vg0 lvm2 [4.00 GiB / 0 free]
PV /dev/sdd1 VG vg0 lvm2 [4.00 GiB / 0 free]
Total: 3 [11.99 GiB] / in use: 3 [11.99 GiB] / in no VG: 0 [0 ]


# vgscan -v
Wiping cache of LVM-capable devices
Wiping internal VG cache
Reading all physical volumes. This may take a while...
Finding all volume groups
Finding volume group "vg0"
Found volume group "vg0" using metadata type lvm2


# lvscan -v
Finding all logical volumes
inactive '/dev/vg0/opt' [11.99 GiB] inherit

At the end, I have no /dev/vg0 and no /etc/lvmtab.

Any ideas?

lvchange -ay /dev/vg0/opt
The volume is not activeated, with this command you actually activate it.

piątek, 1 czerwca 2012

SUSE pljava

link
INSTALL PLJAVA ON OPENSUSE
Install SUN/Oracle JDK and PostgreSQL via zypper or Yast.

Download pljava here http://pgfoundry.org/frs/?group_id=1000038&release_id=1024

Create a directory for example /usr/src/pljava and extract pljava there.

create /etc/ld.so.conf.d/postgres.conf with this two lines in it if your using i386 cpu architecture.

/usr/lib/jvm/java/lib
/usr/lib/jvm/jre/lib/i386/server
now you have to run:

ldconfig

edit /var/lib/pgsql/data/postgresql.conf and add this two lines

custom_variable_classes = 'pljava'
pljava.classpath = '/usr/lib/postgresql/pljava.jar'
copy /usr/src/pljava/pljava.jar and /usr/src/pljava/pljava.so to /usr/lib/postgresql/

cp /usr/src/pljava/pljava.jar /usr/lib/postgresql/
cp /usr/src/pljava/pljava.so /usr/lib/postgresql/
restart postgres service:

rcpostgres restart

apply the install.sql:

su postgres -c "/usr/bin/psql -d template1 -f /usr/src/pljava/install.sql"

RAID1 - MIRROR

Link
1. Create a new RAID array

Create (mdadm –create) is used to create a new array:
mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2
or using the compact notation:
mdadm -Cv /dev/md0 -l1 -n2 /dev/sd[ab]1

2. /etc/mdadm.conf

/etc/mdadm.conf or /etc/mdadm/mdadm.conf (on debian) is the main configuration file for mdadm. After we create our RAID arrays we add them to this file using:
mdadm --detail --scan >> /etc/mdadm.conf
or on debian
mdadm --detail --scan >> /etc/mdadm/mdadm.conf

3. Remove a disk from an array

We can’t remove a disk directly from the array, unless it is failed, so we first have to fail it (if the drive it is failed this is normally already in failed state and this step is not needed):
mdadm --fail /dev/md0 /dev/sda1
and now we can remove it:
mdadm --remove /dev/md0 /dev/sda1

This can be done in a single step using:
mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1

4. Add a disk to an existing array

We can add a new disk to an array (replacing a failed one probably):
mdadm --add /dev/md0 /dev/sdb1

5. Verifying the status of the RAID arrays

We can check the status of the arrays on the system with:
cat /proc/mdstat
or
mdadm --detail /dev/md0

The output of this command will look like:

cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdb1[1] sda1[0] 104320 blocks [2/2] [UU] md1 : active raid1 sdb3[1] sda3[0] 19542976 blocks [2/2] [UU] md2 : active raid1 sdb4[1] sda4[0] 223504192 blocks [2/2] [UU]
here we can see both drives are used and working fine – U. A failed drive will show as F, while a degraded array will miss the second disk -

Note: while monitoring the status of a RAID rebuild operation using watch can be useful:
watch cat /proc/mdstat

6. Stop and delete a RAID array

If we want to completely remove a raid array we have to stop if first and then remove it:
mdadm --stop /dev/md0
mdadm --remove /dev/md0
and finally we can even delete the superblock from the individual drives:
mdadm --zero-superblock /dev/sda

Finally in using RAID1 arrays, where we create identical partitions on both drives this can be useful to copy the partitions from sda to sdb:
sfdisk -d /dev/sda | sfdisk /dev/sdb

(this will dump the partition table of sda, removing completely the existing partitions on sdb, so be sure you want this before running this command, as it will not warn you at all).

There are many other usages of mdadm particular for each type of RAID level, and I would recommend to use the manual page (man mdadm) or the help (mdadm –help) if you need more details on its usage. Hopefully these quick examples will put you on the fast track with how mdadm works.

Ginekolog dr n. med. Piotr Siwek

Gabinet ginekologiczny specjalista ginekolog - położnik dr n. med. Piotr Siwek