Archive for the Raid Category

Feb 12 2022

upgrade to Slackware-15.0

mkdir /packages
mount /dev/cdrom /packages
telinit 1 | 3

1.  Upgrade your glibc shared libraries. This is important, or things
    might go haywire during the next part of the upgrade:
upgradepkg --install-new /root/slackware/a/aaa_glibc-solibs-*.txz

2.  Upgrade your package utilities and related tools:

    upgradepkg /root/slackware/a/pkgtools-*.txz
    upgradepkg /root/slackware/a/tar-*.txz
    upgradepkg /root/slackware/a/xz-*.txz
    upgradepkg /root/slackware/a/findutils-*.txz

3.  Upgrade everything else (and install new packages):

    upgradepkg --install-new /root/slackware/*/*.t?z

4.  Remove obsolete packages. The CHANGES_AND_HINTS.TXT file should have a
    list of these. You may also wish to go into /var/lib/pkgtools/packages
    and take a look at the package list:


    ls -lt | less
    removepkg --terse ConsoleKit2 PyQt Thunar aaa_elflibs amarok amor ash \
      automoc4 bigreqsproto calligra-l10n-bs calligra-l10n-ca \
      calligra-l10n-ca@valencia calligra-l10n-cs calligra-l10n-da \
      calligra-l10n-de calligra-l10n-el calligra-l10n-en_GB calligra-l10n-es \
      calligra-l10n-et calligra-l10n-fi calligra-l10n-fr calligra-l10n-gl \
      calligra-l10n-hu calligra-l10n-it calligra-l10n-ja calligra-l10n-kk \
      calligra-l10n-nb calligra-l10n-nl calligra-l10n-pl calligra-l10n-pt \
      calligra-l10n-pt_BR calligra-l10n-ru calligra-l10n-sk calligra-l10n-sv \
      calligra-l10n-tr calligra-l10n-uk calligra-l10n-zh_CN \
      calligra-l10n-zh_TW cargo cgmanager compositeproto damageproto db42 \
      db44 dirmngr dmxproto dri2proto dri3proto eigen2 eject evieext \
      fixesproto fontcacheproto fontsproto gcc-java getty-ps glade3 \
      glibc-solibs glproto gnome-themes-standard gnu-cobol gst-plugins-base0 \
      gst-plugins-good0 gstreamer0 gtk-xfce-engine herqq idnkit ilmbase \
      imapd inputproto intel-gpu-tools js185 kaccessible kajongg \
      kaudiocreator kbproto kde-base-artwork kde-baseapps kde-l10n-ar \
      kde-l10n-bg kde-l10n-bs kde-l10n-ca kde-l10n-ca@valencia kde-l10n-cs \
      kde-l10n-da kde-l10n-de kde-l10n-el kde-l10n-en_GB kde-l10n-es \
      kde-l10n-et kde-l10n-eu kde-l10n-fa kde-l10n-fi kde-l10n-fr \
      kde-l10n-ga kde-l10n-gl kde-l10n-he kde-l10n-hi kde-l10n-hr \
      kde-l10n-hu kde-l10n-ia kde-l10n-id kde-l10n-is kde-l10n-it \
      kde-l10n-ja kde-l10n-kk kde-l10n-km kde-l10n-ko kde-l10n-lt \
      kde-l10n-lv kde-l10n-mr kde-l10n-nb kde-l10n-nds kde-l10n-nl \
      kde-l10n-nn kde-l10n-pa kde-l10n-pl kde-l10n-pt kde-l10n-pt_BR \
      kde-l10n-ro kde-l10n-ru kde-l10n-sk kde-l10n-sl kde-l10n-sr \
      kde-l10n-sv kde-l10n-tr kde-l10n-ug kde-l10n-uk kde-l10n-wa \
      kde-l10n-zh_CN kde-l10n-zh_TW kde-runtime kde-wallpapers kde-workspace \
      kdeartwork kdegraphics-strigi-analyzer kdelibs \
      kdenetwork-strigi-analyzers kdepim kdepim-apps-libs kdepimlibs \
      kdesdk-strigi-analyzers kdevelop-php kdevelop-php-docs kdevplatform \
      kdewebdev keybinder kgamma kio-mtp klettres korundum kplayer kppp \
      kremotecontrol ksaneplugin ksnapshot ksysguard ktuberling ktux \
      kuser kwebkitpart lha libXfont libart_lgpl libbluedevil libcroco \
      libkdeedu libkgeomap liblastfm libmcs libmm-qt libmowgli libmsn \
      libnm-qt libtermcap libva-intel-driver libwmf-docs mailx man \
      mkfontdir mozjs52 mozjs60 mozjs68 mplayerthumbs nepomuk-core \
      nepomuk-widgets notify-python openldap-client openssl10 \
      openssl10-solibs orage oxygen-icons pairs perlkde perlqt \
      phonon-gstreamer pm-utils presentproto printproto pth pykde4 pyrex \
      python python-enum34 qca-qt5 qimageblitz qjson qt qt-gstreamer qtruby \
      qtscriptgenerator randrproto raptor2 rasqal recordproto redland \
      renderproto resourceproto rfkill rxvt scim scim-anthy scim-hangul \
      scim-input-pad scim-m17n scim-pinyin scim-tables scrnsaverproto \
      seamonkey-solibs sendmail sendmail-cf slocate smokegen smokekde \
      smokeqt soprano strigi superkaramba tetex tetex-doc transfig trn \
      urwid videoproto virtuoso-ose wicd-kde wireless-tools workbone \
      xcmiscproto xextproto xf86-video-xgi xf86-video-xgixp xf86bigfontproto \
      xf86dgaproto xf86driproto xf86miscproto xf86vidmodeproto xfractint \
      xineramaproto xproto xv


5.  IMPORTANT! *Before* attempting to reboot your system, you will need
    to make sure that the bootloader has been updated for the new kernel!
    First, be sure your initrd is up to date (if you use one). You can
    build a new initrd automatically by running the geninitrd script:

6. Genereate initrd
edit /usr/share/mkinitrd/mkinitrd_command_generator.sh
USING_RAID="Y"

mkinitrd -c -k 5.15.19 -f ext4 -r /dev/md0 -m jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -R -u -o /boot/initrd.gz
genitrd

7. ln -s /lib64/libcrypto.so.1.1 /lib64/libcrypto.so.1
8. reboot
May 25 2012

LVM on RAID 10

mdadm -v –create /dev/md1 –level=raid10 –raid-devices=4 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2
pvcreate /dev/md1
vgcreate vg-server1 /dev/md1
lvcreate -L4g -nlv-home vg-server1
lvcreate -L2g -nlv-var vg-server1
lvcreate -L1g -nlv-tmp vg-server1

The -L option specifies the size of the volume

lvcreate -l 100%FREE -nlv-home vg (creates all of the unallocated space in the volume group)

reducing volume  to 100GB (not for XFS filesystem!)

  1. umount /dev/vg-server1/lv-zapas
  2. e2fsck -f /dev/vg-server1/lv-zapas
  3. resize2fs -p  /dev/vg-server1/lv-zapas 100G
  4. lvreduce -L 100G /dev/vg-server1/lv-zapas
  5. e2fsck -f /dev/vg-server1/lv-zapas
  6. resize2fs -p  /dev/vg-server1/lv-zapas 
  7. e2fsck -f /dev/vg-server1/lv-zapas
  8. mount /dev/vg-server1/lv-zapas

extending volume up to 100GB  (not for XFS filesystem !)

  1. umount /dev/vg-server1/lv-home
  2. lvextend -L 100G /dev/vg-server1/lv-home or  lvextend -l +100%FREE /dev/vg-server1/lv-home)
  3. e2fsck -f /dev/vg-server1/lv-home
  4. resize2fs -p  /dev/vg-server1/lv-home
  5. e2fsck -f /dev/vg-server1/lv-home
  6. mount /dev/vg-server1/lv-home

 

extending volume + 1GB

lvextend -L+1G /dev/vg-server1/lv-var



					
May 25 2012

reinstaling lilo

Boot from any Live CD

mkdir /myraid
mount /dev/md0 /myraid
mount /dev/sda1 /myraid/boot
mount –bind /dev /myraid/dev
mount -t devpts devpts /myraid/dev/pts
mount -t proc proc /myraid/proc
mount -t sysfs sysfs /myraid/sys
chroot /myraid
lilo
exit

 

May 25 2012

umounting and deleteing array

umount /dev/md0
mdadm –stop /dev/md0
mdadm –zero-superblock /dev/sda1
mdadm –zero-superblock /dev/sdb1
mdadm –zero-superblock /dev/sdc1
mdadm –zero-superblock /dev/sdd1

Apr 19 2012

software RAID repair (naprawa macierzy RAID)

1. In this example RAID  contents two disks (/dev/sda, /dev/sdb)  and 4 partitions ( md0, md1, md2, md3)
cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md1 : active raid1 sdb5[1] sda5[0]
 20979264 blocks [2/2] [UU]
md2 : active raid1 sda6[0] sdb6[1]
 20979968 blocks [2/2] [UU]
md3 : active raid1 sdb7[1] sda7[0]
 880264320 blocks [2/2] [UU]
md0 : active raid1 sdb1[1] sda1[0]
 20979648 blocks [2/2] [UU]
unused devices: <none>

2. If the RAID fail you will see

cat /proc/mdstat
 Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
 md1 : active raid1 sda5[0]
       20979264 blocks [2/1] [U_]
 md2 : active raid1 sda6[0]
       20979968 blocks [2/1] [U_]
 md3 : active raid1 sda7[0]
       880264320 blocks [2/1] [U_]
 md0 : active raid1 sda1[0]
       20979648 blocks [2/1] [U_]
 unused devices:

3. Disconnect failed hdd

4. Connect new hdd

5. Loook into dmesg for hdd letter

6. remove failed hdd from raid (usuniecie uszkodzonego dysku z macierzy)

mdadm /dev/md0 --fail detached --remove detached
mdadm /dev/md1 --fail detached --remove detached
mdadm /dev/md2 --fail detached --remove detached
mdadm /dev/md3 --fail detached --remove detached

7. copy partitions structure from old GOOD HDD to the new one ( kopiujemy strukture partycji z jednego dysku na drugi)

sfdisk -d /dev/sda | sfdisk /dev/sde

8. Add new hdd into RAID (# dodajemy nowo wsadzony dysk)

mdadm --add /dev/md0 /dev/sde1
mdadm --add /dev/md1 /dev/sde5
mdadm --add /dev/md2 /dev/sde6
mdadm --add /dev/md3 /dev/sde7

9. Rebuilding starts automaticaly, You can see RAID status by

cat /proc/mdstat

 10. and WHEN ALL PARTITIONS ARE REBUILDED run:

mdadm --detail --scan >> /etc/mdadm.conf
Apr 18 2012

raid1 on existing filesystem -> Example

Existing filesystem is on /dev/sda

/dev/root  /
/dev/sda5 /var
/dev/sda6 /usr
/dev/sda8  /home

Connect new disk (for example /dev/sdb)

Copy partition structure from sda to sdc:

sfdisk -d /dev/sda | sfdisk /dev/sdb

or if disk has differ size

create the same size ( or bigger) partitions on sdb

end change type for fd (Linux raid autodetect)

change disk’s blkid

tune2fs -U random /dev/sdb

Next, create the single-disk RAID-1 array. Note the “missing” keyword is specified as one of our devices. We are going to fill this missing device later.

mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1

or

mdadm --create /dev/md0 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb1

and for other partitions

mdadm --create /dev/md1 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb5
mdadm --create /dev/md2 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb6
mdadm --create /dev/md3 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb7

cat /proc/mdstat shows just created raid

Use the file system of your preference here. I'll use ext4 for this guide.
mkfs -t ext4 -j -L RAID-ONE /dev/md0
mkfs -t ext4 -j -L RAID-ONE /dev/md1
mkfs -t ext4 -j -L RAID-ONE /dev/md2
mkfs -t ext4 -j -L RAID-ONE /dev/md3

Make a file system on the swap partition:

mkswap -L NEW-SWAP /dev/sdb2

The new RAID-1 array is ready to start accepting data! So now we need to mount the array, and copy everything from the old system to the new system

 mkdir /tmp/md0 /tmp/md1 /tmp/md2 /tmp/md3
 mount /dev/md0 /tmp/md0

 mount /dev/md1 /tmp/md1
 mount /dev/md2 /tmp/md2
 mount /dev/md3 /tmp/md3
 rsync -avxHAXS --delete --progress /home/ /tmp/md3
 rsync -avxHAXS --delete --progress /var/ /tmp/md2
 rsync -avxHAXS --delete --progress /usr/ /tmp/md1
 rsync -avxHAXS --delete --progress / /tmp/md0

edit /etc/fstab and change mounting points to appropriate /dev/md0 .. /dev/md3

and add line:

/dev/sdb2  swap swap defaults 0 0

reboot with opition  root=/dev/md0 (where my root filesystem was located).

telinit 1 ?

First, open /dev/sda with fdisk and change all the partittions you want to have added to the array to type fd – linux raid autodetection.

Then, for each degraded array, add the appropriate non-array device to it:

mdadm /dev/md0 -a /dev/sda1

(wait for finish recovery)

(umount/dev/sda5)
mdadm /dev/md1 -a /dev/sda5

(wait for finish recovery)

umount/dev/sda6
mdadm /dev/md2 -a /dev/sda6

(wait for finish recovery)

umount/dev/sda8
mdadm /dev/md3 -a /dev/sda8

(wait for finish recovery)

Ensure your /etc/lilo.conf has the correct setup:
boot=/dev/md0
raid-extra-boot=mbr-only
root=/dev/md0

and type:

lilo

LILO will write boot information to each of the individual raid devices boot sectors, so if either /boot or your root partition are on failed disks, you’ll still be able to boot.

Create /etc/mdadm/mdadm.conf.
in /etc/mdadm/mdadm.conf put line:
DEVICE /dev/sda* /dev/sdb*

and WHEN ALL PARTITIONS ARE REBUILDED run:

mdadm --detail --scan >> /etc/mdadm.conf