Showing posts with label freebsd. Show all posts
Showing posts with label freebsd. Show all posts

Wednesday, May 22, 2013

Ports extracting on old freebsd (7.2 my), xz inappropriate file type or format

Before starting compiling libarchive, i put spawn.h to /usr/include, because in my system it doesn't existed.

CC     libarchive/filter_fork_posix.lo
libarchive/filter_fork_posix.c:61:21: error: spawn.h: No such file or directory
*** Error code 1

Stop in /usr/ports/archivers/libarchive/work/libarchive-3.1.2.
*** Error code 1

# cd /usr/include/
# wget https://gist.github.com/OmIkRoNiXz/5625492/raw/71b8edba74636f513a0e301a2da12caa2d68f417/spawn.h

Now i can install libarchive.

# cd /usr/ports/archivers/libarchive 
# make install clean

# ln -sf /usr/local/bin/bsdtar /usr/bin/tar

And it all!

Saturday, February 9, 2013

Replacing degraded disk in RAID1 3ware LSI


server# tw_cli

//server> /c0 show

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-1    DEGRADED       -       -       -       465.651   OFF    OFF

VPort Status         Unit Size      Type  Phy Encl-Slot    Model
------------------------------------------------------------------------------
p0    DEGRADED       u0   465.76 GB SATA  0   -            ST3500320NS
p1    OK             u0   465.76 GB SATA  1   -            WDC WD5003ABYX-01WE

/* removeing degraded disk */

//server> /c0/p0 remove Removing /c0/p0 will take the disk offline. Do you want to continue ? Y|N [N]: Y Removing port /c0/p0 ... Done. //server> /c0 show Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 DEGRADED - - - 465.651 OFF OFF VPort Status Unit Size Type Phy Encl-Slot Model ------------------------------------------------------------------------------ p1 OK u0 465.76 GB SATA 1 - WDC WD5003ABYX-01WE

/* physically insert new hard disk and scan for this */

//server> /c0 rescan //server> /c0 show Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 DEGRADED - - - 465.651 OFF OFF VPort Status Unit Size Type Phy Encl-Slot Model ------------------------------------------------------------------------------ p0 OK - 465.76 GB SATA 0 - WDC WD5003ABYX-01WE p1 OK u0 465.76 GB SATA 1 - WDC WD5003ABYX-01WE

/* start rebuilding array */

//server> maint rebuild c0 u0 p0 Sending rebuild start request to /c0/u0 on 1 disk(s) [0] ... Done.

/* display status of rebuilding */

//server> info c0 Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy ------------------------------------------------------------------------------ u0 RAID-1 REBUILDING 5% - - 465.651 OFF OFF VPort Status Unit Size Type Phy Encl-Slot Model ------------------------------------------------------------------------------ p0 DEGRADED u0 465.76 GB SATA 0 - WDC WD5003ABYX-01WE p1 OK u0 465.76 GB SATA 1 - WDC WD5003ABYX-01WE

Sunday, February 3, 2013

Some useful linux/*nix cmds

Send cmd to screen (echo -ne '\015' emulates pressing the Enter key)
# screen -S sessionname -p 0 -X stuff 'command'`echo -ne '\015'`
Search file in packages (debian like distros)
# dpkg -S /etc/foo/foo.conf  
Check port availability
# nc -znvvw 3 192.168.1.100 80
Check availability of port range
# nc -znvvw 3 192.168.1.100 8080-8081
Row count in files with *.php extension
# find /root/* -type f -name "*.php" -exec wc -l {} + ;
Find files larger than 100MB
# find . -size +100M -exec du -h {} \;
SSH port forwarding example for SQL Server (remote-server - which have access to SQL Server by Local address 192.168.1.50, then we can connect to localhost:1433)
# ssh -f remote-server -L127.0.0.1:1433:192.168.1.50:1433 -N

FreeBSD

Get S.M.A.R.T for 3ware raided HDDs (disks starts from 0, 1, 2...)
# smartctl -a -d 3ware,0 /dev/twa0
Renew sendmail aliases
# cd /etc/mail
# make
# newaliases