… o všem možném …

hrad_kost2 trosky

Hrad Kost a Trosky

hrad_kost2 trosky

A way how to execute commands on other tty/pts. A simple echo won’t work because echo writes to the output buffer, while I need to push these commands to the input buffer of the tty/pts.

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <string.h>
#include <unistd.h>

void print_help(char *prog_name) {
        printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
        printf("Usage: '-n' is an optional argument if you want to push a new line at the end of the text\n");
        printf("Usage: Will require 'sudo' to run if the executable is not setuid root\n");

int main (int argc, char *argv[]) {
    char *cmd, *nl = "\n";
    int i, fd;
    int devno, commandno, newline;
    int mem_len;
    devno = 1; commandno = 2; newline = 0;
    if (argc < 3) {
    if (argc > 3 && argv[1][0] == '-' && argv[1][1] == 'n') {
        devno = 2; commandno = 3; newline=1;
    } else if (argc > 3 && argv[1][0] == '-' && argv[1][1] != 'n') {
        printf("Invalid Option\n");
    fd = open(argv[devno],O_RDWR);
    if(fd == -1) {
        perror("open DEVICE");
    mem_len = 0;
    for ( i = commandno; i < argc; i++ ) {
        mem_len += strlen(argv[i]) + 2;
        if ( i > commandno ) {
            cmd = (char *)realloc((void *)cmd, mem_len);
        } else { //i == commandno
            cmd = (char *)malloc(mem_len);

        strcat(cmd, argv[i]);
        strcat(cmd, " ");
  if (newline == 0)
    for (i = 0; cmd[i]; i++)
        ioctl (fd, TIOCSTI, cmd+i);
    if (newline == 1)
        ioctl (fd, TIOCSTI, nl);
    free((void *)cmd);
    exit (0);

Copy the above code to some C file (For eg. tty-send-command.c). Run the following command in the directory you have created the C file in to compile the code.

make tty-send-command

Copy this file to the bin directory.

Start another terminal or switch to any other open terminal that you wish to control and execute the command tty. You can see a sample output below.

@~$ tty

Now to execute a command on /dev/pts/4, run the following command in the controlling/original terminal.

sudo tty-send-command -n /dev/pts/4 echo "Hello there"

You will see that the ls command is executed in /dev/pts/4. The -n option makes tty-send-command send a newline after the command, so that the command gets executed and not just inserted. This utility can infact be used to send any data to other terminals For eg, you could open vim in /dev/pts/4 and then run the following command in the controlling terminal to cause vim to exit in /dev/pts/4.

sudo tty-send-command -n /dev/pts/4 :q

To avoid using sudo all the time, so that the command is easily scriptable, change the owners/permissions of this executable using the following commands.

sudo chown root:root tty-send-command
sudo chmod u+s tty-send-command

What we did was change the owner/group to root and set the setuid bit for the executable which will allow you to run the utility with root permissions.

Setting the setuid bit can become a security risk.

Antonov AN-225 Mriya

Největší letadlo navštívilo ostravské letiště (po 25-ti letech).

Fotky jsou z ranního odletu v pátek 30.ledna 2015.








Technické údaje letadla (zdroj internet):

  • Posádka: 6 osob (pilot, kopilot, dva letoví inženýři, navigátor a radista)
  • Motory: 6x Progress D-18T Series 3 turbofans, každý o tahu 229 kN (51590 lbs)
  • Délka: 84,00 m
  • Výška: 18,20 m
  • Rozpětí křídel: 88,40 m
  • Plocha křídel: 905 m²
  • Rozpětí VOP: 32,65 m
  • Kapacita palivových nádrží: více než 300 000 l
  • Hmotnost prázdného letadla: 175 000 kg
  • Maximální vzletová hmotnost: 600 000 kg
  • Náklad vně letadla:
    • Max. hmotnost: 200 tun
  • Náklad uvnitř letadla
    • Max. hmotnost: 250 tun
    • Max. výška: 4,4 m
    • Max. šířka: 6,4 m
    • Max. délka: 43,0 m
  • Objem nákladového prostoru: 1 220 m³
    • Cestující: cca 60-70 osob (kabina v zadní části trupu nad nákladovým prostorem)


  • Cestovní rychlost: 800 km/h
  • Maximální rychlost: 850 km/h
  • Potřebná délka ranveje: 3000 – 3500 m
  • Dostup: 11 000 m
  • Cestovní výška: 9 000 m
  • Dolet:
    • S nákladem 200 tun v trupu: 4 500 km
    • S nákladem 150 tun v trupu: 7 000 km
    • S nákladem 100 tun v trupu: 9 600 km
    • Bez nákladu: 15 400 km





Bash Commands

uname -a
Show system and kernel
head -n1 /etc/issue
Show distri­bution
Show mounted filesy­stems
Show system date
Show uptime
Show your username
man command
Show manual for command

Bash Shortcuts

Stop current command
Sleep program
Go to start of line
Go to end of line
Cut from start of line
Cut to end of line
Search history
Repeat last command
Run last command starting with abc
Print last command starting with abc
Last argument of previous command
Last argument of previous command
All arguments of previous command
Run previous command, replacing abc with 123

Bash Variables

Show enviro­nment variables
echo $NAME
Output value of $NAME variable
export NAME=value
Set $NAME to value
Executable search path
Home directory
Current shell

IO Redire­ction

cmd < file
Input of cmd from file
cmd1 <(cmd2)
Output of cmd2 as file input to cmd1
cmd > file
Standard output (stdout) of cmd to file
cmd > /dev/null
Discard stdout of cmd
cmd >> file
Append stdout to file
cmd 2> file
Error output (stderr) of cmd to file
cmd 1>&2
stdout to same place as stderr
cmd 2>&1
stderr to same place as stdout
cmd &> file
Every output of cmd to file
cmd refers to a command.


cmd1 | cmd2
stdout of cmd1 to cmd2
cmd1 |& cmd2
stderr of cmd1 to cmd2

Command Lists

cmd1 ; cmd2
Run cmd1 then cmd2
cmd1 && cmd2
Run cmd2 if cmd1 is successful
cmd1 || cmd2
Run cmd2 if cmd1 is not successful
cmd &
Run cmd in a subshell

Directory Operations

Show current directory
mkdir dir
Make directory dir
cd dir
Change directory to dir
cd ..
Go up a directory
List files

ls Options

Show all (including hidden)
Recursive list
Reverse order
Sort by last modified
Sort by file size
Long listing format
One file per line
Comma-­sep­arated output
Quoted output

Search Files

grep pattern files
Search for pattern in files
grep -i
Case insens­itive search
grep -r
Recursive search
grep -v
Inverted search
grep -o
Show matched part of file only
find /dir/ -name name*
Find files starting with name in dir
find /dir/ -user name
Find files owned by name in dir
find /dir/ -mmin num
Find files modifed less than num minutes ago in dir
whereis command
Find binary / source / manual for command
locate file
Find file (quick search of system index)

File Operations

touch file1
Create file1
cat file1 file2
Concat­enate files and output
less file1
View and paginate file1
file file1
Get type of file1
cp file1 file2
Copy file1 to file2
mv file1 file2
Move file1 to file2
rm file1
Delete file1
head file1
Show first 10 lines of file1
tail file1
Show last 10 lines of file1
tail -F file1
Output last lines of file1 as it changes

Watch a Command

watch -n 5 ‘ntpq -p’
Issue the ‘ntpq -p’ command every 5 seconds and display output

Process Management

Show snapshot of processes
Show real time processes
kill pid
Kill process with id pid
pkill name
Kill process with name name
killall name
Kill all processes with names beginning name

Nano Shortcuts

Read file
Save file
Close file
Cut and Paste
Start marking text
Cut marked text or line
Paste text
Navigate File
End of file
Beginning of line
End of line
Show line number
Go to line number
Search File
Find next
Search and replace

Screen Shortcuts

Start a screen session.
screen -r
Resume a screen session.
screen -list
Show your current screen sessions.
Activate commands for screen.
Create a new instance of terminal.
Go to the next instance of terminal.
Go to the previous instance of terminal.
Show current instances of terminals.
Rename the current instance.

File Permis­sions

chmod 775 file
Change mode of file to 775
chmod -R 600 folder
Recurs­ively chmod folder to 600
chown user:group file
Change file owner to user and group to group

File Permission Numbers

First digit is owner permis­sion, second is group and third is everyone.
Calculate permission digits by adding numbers below.
read (r)
write (w)

If you are running a mission critical server, or maintaining a storage server loaded with sensitive data, you probably want to closely monitor file access activities within the server. For example, you want to track any unauthorized change in system configuration files such as /etc/passwd.

To monitor who changed or accessed files or directories on Linux, you can use the Linux Audit System which provides system call auditing and monitoring. In the Linux Audit System, a daemon called auditd is responsible for monitoring individual system calls, and logging them for inspection.

In this tutorial, I will describe how to monitor file access on Linux by using auditd.

To install auditd on Debian, Ubuntu:

$ sudo apt-get install auditd

Once installed by apt-get, auditd will be set to start automatically upon boot.

To install auditd on Fedora, CentOS or RHEL:

$ sudo yum install audit

If you want to start auditd automatically upon boot on Fedora, CentOS or RHEL, you need to run the following.

$ sudo chkconfig auditd on

Once you installed auditd, you can configure it by two methods. One is to use a command-line utility called auditctl. The other method is to edit the audit configuration file located at /etc/audit/audit.rules. In this tutorial, I will use the audit configuration file.

The following is an example auditd configuration file.

$ sudo vi /etc/audit/audit.rules
# First rule - delete all

# increase the buffers to survive stress events. make this bigger for busy systems.
-b 1024

# monitor unlink() and rmdir() system calls.
-a exit,always -S unlink -S rmdir

# monitor open() system call by Linux UID 1001.
-a exit,always -S open -F loginuid=1001

# monitor write-access and change in file properties (read/write/execute) of the following files.
-w /etc/group -p wa
-w /etc/passwd -p wa
-w /etc/shadow -p wa
-w /etc/sudoers -p wa

# monitor read-access of the following directory.
-w /etc/secret_directory -p r

# lock the audit configuration to prevent any modification of this file.
-e 2

Once you finish editing the audit configuration, restart auditd.

$ sudo service auditd restart

Once auditd starts running, it will start generating an audit daemon log in /var/log/audit/audit.log as auditing is in progress.

A command-line tool called ausearch allows you to query audit daemon logs for specific violations.

To check if a specific file (e.g., /etc/passwd) has been accessed by anyone, run the following. As shown in the above example audit configuration, auditd checks if /etc/passwd is modified or tampered with using chmod.

$ sudo ausearch -f /etc/passwd
time->Sun May 12 19:22:31 2013
type=PATH msg=audit(1368411751.734:94): item=0 name="/etc/passwd" inode=655761 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00
type=CWD msg=audit(1368411751.734:94):  cwd="/home/xmodulo"
type=SYSCALL msg=audit(1368411751.734:94): arch=40000003 syscall=306 success=yes exit=0 a0=ffffff9c a1=8624900 a2=1a6 a3=8000 items=1 ppid=14971 pid=14972 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts2 ses=19 comm="chmod" exe="/bin/chmod" key=(null)

The ausearch output above shows that chmod has been applied to /etc/passwd by the root once.

To check if a specific directory (e.g., /etc/secret_directory) has been accessed by anyone, run the following.

$ sudo ausearch -f /etc/secret_directory
time->Sun May 12 19:59:58 2013
type=PATH msg=audit(1368413998.927:108): item=0 name="/etc/secret_directory/" inode=686341 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00
type=CWD msg=audit(1368413998.927:108):  cwd="/home/xmodulo"
type=SYSCALL msg=audit(1368413998.927:108): arch=40000003 syscall=230 success=no exit=-61 a0=bfcdc4e4 a1=b76f0fa9 a2=8c65c70 a3=ff items=1 ppid=2792 pid=11300 auid=1001 uid=1001 gid=1001 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=pts1 ses=2 comm="ls" exe="/bin/ls" key=(null)

The output shows that /etc/secret_directory was looked into by Linux UID 1001.

In our example audit configuration, auditd was placed in immutable mode, which means that if you attempt to modify /etc/audit/audit.rules, and restart auditd, you will get the following error.

$ sudo /etc/init.d/auditd restart
Error deleting rule (Operation not permitted)
The audit system is in immutable mode, no rules loaded

If you want to be able to modify the audit rules again after auditd is put in immutable mode, you need to reboot your machine after changing the rules in /etc/audit/audit.rules.

If you want to enable daily log rotation for the audit log generated in /var/log/audit directory, use the following command in a daily cronjob.

$ sudo service auditd rotate

Basic vi Commands

What is vi?

The default editor that comes with the UNIX operating system is called vi (visual editor). [Alternate editors for UNIX environments include pico and emacs, a product of GNU.]
The UNIX vi editor is a full screen editor and has two modes of operation:

  1. Command mode commands which cause action to be taken on the file, and
  2. Insert mode in which entered text is inserted into the file.

In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the vi editor to enter the insert mode. In the insert mode, every character typed is added to the text in the file; pressing the <Esc> (Escape) key turns off the Insert mode.

While there are a number of vi commands, just a handful of these is usually sufficient for beginning vi users. To assist such users, this Web page contains a sampling of basic vi commands. The most basic and useful commands are marked with an asterisk (* or star) in the tables below. With practice, these commands should become automatic.
NOTE: Both UNIX and vi are case-sensitive. Be sure not to use a capital letter in place of a lowercase letter; the results will not be what you expect.

To Get Into and Out Of vi

To Start vi

To use vi on a file, type in vi filename. If the file named filename exists, then the first page (or screen) of the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text.


* vi filename edit filename starting at line 1
vi -r filename recover filename that was being edited when system crashed


To Exit vi

Usually the new or modified file is saved when you leave vi. However, it is also possible to quit vi without saving the file.
Note: The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the <Return> (or <Enter>) key.


* :x<Return> quit vi, writing out modified file to file named in original invocation
:wq<Return> quit vi, writing out modified file to file named in original invocation
:q<Return> quit (or exit) vi
* :q!<Return> quit vi even though latest changes have not been saved for this vi call


Moving the Cursor

Unlike many of the PC and MacIntosh editors, the mouse does not move the cursor within the vi editor screen (or window). You must use the the key commands listed below. On some UNIX platforms, the arrow keys may be used as well; however, since vi was designed with the Qwerty keyboard (containing no arrow keys) in mind, the arrow keys sometimes produce strange effects in vi and should be avoided.
If you go back and forth between a PC environment and a UNIX environment, you may find that this dissimilarity in methods for cursor movement is the most frustrating difference between the two.
In the table below, the symbol ^ before a letter means that the <Ctrl> key should be held down while the letter key is pressed.


* j or <Return>
[or down-arrow]
move cursor down one line
* k [or up-arrow] move cursor up one line
* h or <Backspace>
[or left-arrow]
move cursor left one character
* l or <Space>
[or right-arrow]
move cursor right one character
* 0 (zero) move cursor to start of current line (the one with the cursor)
* $ move cursor to end of current line
w move cursor to beginning of next word
b move cursor back to beginning of preceding word
:0<Return> or 1G move cursor to first line in file
:n<Return> or nG move cursor to line n
:$<Return> or G move cursor to last line in file


Screen Manipulation

The following commands allow the vi editor screen (or window) to move up or down several lines and to be refreshed.


^f move forward one screen
^b move backward one screen
^d move down (forward) one half screen
^u move up (back) one half screen
^l redraws the screen
^r redraws the screen, removing deleted lines


Adding, Changing, and Deleting Text

Unlike PC editors, you cannot replace or delete text by highlighting it with the mouse. Instead use the commands in the following tables.
Perhaps the most important command is the one that allows you to back up and undo your last action. Unfortunately, this command acts like a toggle, undoing and redoing your most recent action. You cannot go back more than one step.


* u UNDO WHATEVER YOU JUST DID; a simple toggle
The main purpose of an editor is to create, add, or modify text for a file.

Inserting or Adding Text

The following commands allow you to insert and add text. Each of these commands puts the vi editor into insert mode; thus, the <Esc> key must be pressed to terminate the entry of text and to put the vi editor back into command mode.


* i insert text before cursor, until <Esc> hit
I insert text at beginning of current line, until <Esc> hit
* a append text after cursor, until <Esc> hit
A append text to end of current line, until <Esc> hit
* o open and put text in a new line below current line, until <Esc> hit
* O open and put text in a new line above current line, until <Esc> hit


Changing Text

The following commands allow you to modify text.


* r replace single character under cursor (no <Esc> needed)
R replace characters, starting with current cursor position, until <Esc> hit
cw change the current word with new text,
starting with the character under cursor, until <Esc> hit
cNw change N words beginning with character under cursor, until <Esc> hit;
e.g., c5w changes 5 words
C change (replace) the characters in the current line, until <Esc> hit
cc change (replace) the entire current line, stopping when <Esc> is hit
Ncc or cNc change (replace) the next N lines, starting with the current line,
stopping when <Esc> is hit


Deleting Text

The following commands allow you to delete text.


* x delete single character under cursor
Nx delete N characters, starting with character under cursor
dw delete the single word beginning with character under cursor
dNw delete N words beginning with character under cursor;
e.g., d5w deletes 5 words
D delete the remainder of the line, starting with current cursor position
* dd delete entire current line
Ndd or dNd delete N lines, beginning with the current line;
e.g., 5dd deletes 5 lines


Cutting and Pasting Text

The following commands allow you to copy and paste text.


yy copy (yank, cut) the current line into the buffer
Nyy or yNy copy (yank, cut) the next N lines, including the current line, into the buffer
p put (paste) the line(s) in the buffer into the text after the current line


Other Commands

Searching Text

A common occurrence in text editing is to replace one word or phase by another. To locate instances of particular sets of characters (or strings), use the following commands.


/string search forward for occurrence of string in text
?string search backward for occurrence of string in text
n move to next occurrence of search string
N move to next occurrence of search string in opposite direction


Determining Line Numbers

Being able to determine the line number of the current line or the total number of lines in the file being edited is sometimes useful.


:.= returns line number of current line at bottom of screen
:= returns the total number of lines at bottom of screen
^g provides the current line number, along with the total number of lines,
in the file at the bottom of the screen


Saving and Reading Files

These commands permit you to input and output files other than the named file with which you are currently working.


:r filename<Return> read file named filename and insert after current line
(the line with cursor)
:w<Return> write current contents to file named in original vi call
:w newfile<Return> write current contents to a new file named newfile
:12,35w smallfile<Return> write the contents of the lines numbered 12 through 35 to a new file named smallfile
:w! prevfile<Return> write current contents over a pre-existing file named prevfile


:r filename<Return> read file named filename and insert after current line
(the line with cursor)
:w<Return> write current contents to file named in original vi call
:w newfile<Return> write current contents to a new file named newfile
:12,35w smallfile<Return> write the contents of the lines numbered 12 through 35 to a new file named smallfile
:w! prevfile<Return> write current contents over a pre-existing file named prevfile

Veritas Cheat Sheet


vxdisk list
 List all disks used by Veritas (VX).

vxdisk list <diskname>
 Display detailed information about a 
 single disk, including mutlipathing
 information, size, type, Vx version,
 and more.

 Display report style information about
 the current status of all Vx componants,
 including disks, subdisks, plexes, and

vxprint <componant>
 Display report style information about
 the current status of ONLY the componant
 you request. So for instance, 
 "vxprint vol01" shows information about
 all subcomponants of vol01. This works
 for plexes, disk groups, etc.

vxprint -hrt
 Display detailed information about all
 Vx componanats, including stwdith, 
 ncolumns, offsets, layout type, read-
 policy, and more. This is best for
 a true picture of your configuration.

vxdg list
 Display listing and state information
 of all Disk Groups.

vxdg list <diskgroup name>
 Display detailed information about
 a diskgroup, including flags, version,
 logs status, etc.

 Display volume status and volume type.
 By default, only displays "rootdg", 
 to display a diffrent Disk Group,
 use "vxinfo -g <dgname>".

vxassist maxgrow <volume>
 This command will output the maximum size
 the volume specified can increased by,
 specified in sectors.


vxdiskadd <devname>
 Adds a disk to Vx by Initializing and Encapsolating
 it. Specified by its device name (ex: c0t1d0s2).
 NOTE: You'll need to reboot to finalize the
 disk addition!
 This command, can also be used to add a disk to
 a specified disk group. Just follow the prompts.
 No reboots needed for changing DG's.

vxedit rename <oldname> <newname>
 Rename a Vx disk. Ex: "vxedit rename disk01 disk05"

vxedit set reserve=on <diskname>
 Sets the "reserve" flag to a Vx disk. This
 is used to keep specific disks from being
 accidentally, or generally used.

vxdisk offline <diskname>
 Used to "offline" a disk. The disk should
 be removed from its diskgroup before being 

vxdisk rm <devname>
 Used to remove disks from Vx control completely.
 Ex: "vxdisk rm c0t1d0s2" Make sure to 
 removed the disk from its diskgroup, and offline
 the disk before removing it.

vxedit set spare=on <diskname>
 Sets the "spare" flag to a Vx disk. This is used
 to make the specified disk a hot spare, which
 is then added to the "hot spare pool".

vxedit set spare=off <diskname>
 Same as above but removes the disk from the
 "hot spare pool".


vxdg init <diskgroup> <diskname>=<devname>
 Creates a new disk group, and assigns the naming
 scheme to the first disk added to the group.
 ex: "vxdg init newdg newdg01=c0t10d0s2".
 NOTE: This is kinda tricky because the disk that
 you're adding can't be a member of ANY DG, but
 must be initialized. It's easier to use
 "vxdiskadd", and add the disk to a newdg by
 specifying a new DG name for the DG field.

vxdg deport <diskgroup>
 Disabled a diskgroup, but doesn't remove it. Often
 used as an organized pool of disk to realocate, and
 to moved DG's from one system to another.

vxdg import <diskgroup>
 Reverse of above. Enables local access to the specified
 disk group.

vxdg -n <newdgname> <olddgname>
 Change a Disk Groups name.

vxdg list <dgname>
 Use this to check the version numbers of Disk
 Groups. Shows other details about the DG too.

vxdg destroy <dgname>
 Removes the specified DG, and frees all its disks
 back to general use by Vx.

-= Quick Chart!: Disk Group Version Number Translation

 VxVM Introduced Supported
 Release Version Versions
 ------- ------------ ---------
 1.2 10 10
 1.3 15 15
 2.0 20 20
 2.2 30 30
 2.3 40 40
 2.5 50 50
 3.0 60 20-60


vxmake sd <subdiskname> <disk>,<offset>,<length>
 Creates a subdisk with the specified name,
 and by the offset and length specified.
 ex: "vxmake sd disk02-01 disk02,0,8000"
 NOTE: If you are going to add this subdisk
 to a plex, its good to check the other
 subdisks in that plex to see what their
 lengths and offsets are, use the command:
 "vxprint -st"

vxedit rm <subdiskname> 
 Removes a subdisk. 
vxsd assoc <plexname> <subdiskname>,....
 Associates the specified subdisks to
 the specified plex. Example:
 "vxsd assoc vol01-03 disk01-01,disk02-01" 
 NOTE: Striped volumes are diffrent, 
 you need to specify the column# so 
 use the following: 
vxsd -l <col#/offset> assoc <plexname> <subdiskname>,... 
 Same as above, but used for associating
 subdisks to a striped plex. Use the command 
 "vxprint -st" to see what other subdisk
 in the plex look like, and then set the
 new subdisks column number and offset
 (found in the seventh column of output)
 to the appropriate value.
vxsd aslog <plex> <subdiskname>
 Adds a log subdisk to the specified plex. 
 Ex: "vxsd aslog vol01-02 disk03-01" 

vxsd dis <subdiskname>
 Disassociates the specified subdisk from its
 current plex. 


vxmake plex <plexname> sd=<subdiskname>,<subdiskname>,.... 
 Creates a new plex by the name specified and
 assigns the specified subdisks to it.

vxmake plex <plexname> layout=<layout> stwidth=<stwidth> ncolumn=<ncolumn> sd=...
 Like above command, but specifies layout type
 as defined by <layout>, which is used for creation
 of striped and RAID5 plexes. The layout is
 constrained by the defined number of columns,
 and stripe width. Subdisks specified are
 added to the created plex. 

vxplex att <volname> <plexname>
 Associates specified plex with specified volume.
 (Adds a mirror) 
 NOTE: Attachment will take a while. Watch
 it with Vxtask, or via vxprint

vxplex dis <plexname>
 Disassociate specified plex from its connected 

vxedit -r rm <plexname>
 Remove the plex.

vxmend off <plexname>
 Offlines a plex for repair to it's disks.

vxplex det <plexname>
 Detaches specified plex from its connected
 volume, but maintians association with it's
 volume. The plex is no longer used
 for I/O untill it is (re)attached.

vxmend fix clean <plexname>
 Used to clean plexes that are in the
 "unclean" state. Used with unstartable

vxplex mv <originalplex> <newplex>
 Moves the data content from the origonal
 plex onto a new plex. 
 NOTE: The old plex must be active (ENABLED).
 The new plex should be the same length, or
 larger than the old plex. The new plex 
 must not be associated with another volume.

vxplex cp <volume> <newplex>
 Copies the data from the specified volume
 to a new plex.
 NOTE: The new plex cannot be associated
 with any other volume. The new plex,
 further, will NOT be attached to 
 the specified volume. (Also, see notes
 from above)


vxassist make <volumename> <length>
 Creates a new volume with the name specified
 and is made to the length specified. 
 Ex: "vxassist make newvol 10m"
 NOTE: This command will pull disk space
 from the generally avalible Vx disk space.

vxassist make <volname> <length> layout=<layouttype> <disk> <disk> ....
 Like the above command, but with layout specified.
 The most common layouts are: striped and raid5
 ex: "vxassist make newvol 100m layout=raid5 disk01 disk02 disk03"
 NOTE: See the vxassist(1M) man page for more information.

vxmake vol <volname> len=<length> plex=<plexname>,...
 Creates a new volume of specified length (usually
 in sectors), and attachs the specified plexes to that
 volume. Useful for creating volumes to house 
 copied or moved plexes.
 NOTE: See the vxmake(1M) man page for more information.

vxvol init <state> <volname> [plexname]
 Manually sets the state of a volume.
 NOTE: Not for the squimish.

vxassist maxsize [layout=raid5]
 Returns the maximum size avalible via Vx to create
 a new volume. By adding "layout=raid5" to the command
 the calulations take into account losse due
 to raid5. Output is in sectors and Megs.

vxassist maxgrow <volname>
 Returns the maximum ammount of Vx space that
 can be added to the specified volume.

vxassist mirror <volname>
 Creates a mirror for the specified volume.
 NOTE: Think of this as "handsfree plex creation".
 This is fast, but the disks you want used 
 may not be used... often best to do manually.

vxassist addlog <volname>
 Adds a Dirty Region Log (DRL) for the specified volume.

vxassist remove log <volname>
 Reverse of above.

vxvol start <volname>
 Starts a volume

vxvol stop <volname>
 Stops a volume. Alternately you can use command as
 such: "vxvol stopall" in order to stop all volumes.

vxassit growto/growby/shrinkto/shrinkby <volname> <length>
 Resizes the volume specified. Use one of the
 following: growto, growby, shrinkto, and shrinkby
 in order to descide what <length> specifies.
 By default length is specified in sectors.
 This does not resize the filesystem inside the volume.
 NOTE: Don't shrink volumes to be less that 
 its contained filesystem! (duh)

vxvol set len=<length> <volname>
 An alternate to above command. Sets the absolute
 lenths of the specified volume to the length
 specified, by default, in sectors. This 
 does not resize the filesystem inside the volume.

 NOTE: There is also a resize(1M) command, used
 for resizing both volume AND filesytem. See
 the man page for that one.

vxedit rm <volname>
 Removes the specified volume. (poof!)
 NOTE: If the volume specified is in the ENABLED
 state, you will need to use the command
 "vxedit -f <volname>". Also, using the "r"
 with "f" will remove all plexes and subdisks
 with the volume. If you didn't guess, "r"
 is Recursive, and "f" is Force.

Misc Stuff:

To calculate the size of a filesystem inside a volume, use
the command:
 fstyp -v <volume-device-path> | head -30 | grep ncg
Ignore the errors. Output will look this this:
 # fstyp -v /dev/vx/rdsk/datadg/vol01 | head -30 | grep ncg
 ncg 17152 size 70254592 blocks 65863396
 # Broken Pipe
 Unknown_fstyp (no matches)
The size found after the label "size" is presented in kilobytes.
You can convert to sectors by multiplying by 2.


To calculate the size of a volume, use vxprint, and look for the
"len". The volume length is in sectors. Convert to kilobytes
by dividing by 2.


Volume Growth Procudure:
1) You can use vxassist to estimate the max size of 
a given volume based on the disks you wish to add:
ex: # vxassist -g rootdg maxgrow vol01 disk01 disk02 disk03

2) Next, actually grow the volume (NOT THE FS) via the 
command (assuming maxgrow outputed 10639360 as the maxsize):
ex:# vxassist -g rootdg growto vol01 10639360 disk01 disk02 disk03

3) Now VxVM grinds away, monitor with vxtask.

4) Now Grow the Filesystem, for UFS use:
# /usr/lib/fs/ufs/mkfs -F ufs -M /export /dev/vx/rdsk/rootdg/vol01 10639360

for VXFS ufs:
# /usr/lib/fs/vxfs/fsadm -b 10639360 -r /dev/vx/rdsk/rootdg/vol01 /mnt

5) Done!


Changing User/Group of a Raw Volume: (ex:)
 vxedit -g xxxdg set group=dba data_vol_123
 vxedit -g xxxdg set user=oracle data_vol_123

This post will cover how to increase the disk space for a VMware virtual machine running Linux that is using logical volume manager (LVM). Firstly we will add a new disk to the virtual machine and then extend the original LVM over this additional space. Basically we will have two physical disks but just one volume group and one logical group that is using the space on both disks together. With this method there is no down time for the virtual machine.

As there are a number of different ways to increase disk space I have also posted some different methods here:

Important Notes: Be very careful when working with the commands in this article as they have the potential to cause a lot of damage to your data. If you are working with virtual machines make sure you take a snapshot of your virtual machine beforehand, or otherwise have some other form of up to date backup before proceeding. It could also be worth cloning the virtual machine first and testing out this method on the clone.

Throughout my examples I will be working with a VMware virtual machine running Debian 6, this was set up with a 20gb disk and we will be adding a new 20gb disk for a total LVM size of 40gb.

Although my examples make use of virtual machines, this method would work with a physical server as well if you have added a new physical disk in and want to use that to expand the LVM.

Identifying the partition type

As this method focuses on working with LVM, we will first confirm that our partition type is actually Linux LVM by running the below command.

fdisk -



As you can see in the above image /dev/sda5 is listed as “Linux LVM” and it has the ID of 8e. The 8e hex code shows that it is a Linux LVM, while 83 shows a Linux native partition. Now that we have confirmed we are working with an LVM we can continue.

Below is the disk information showing that our initial setup only has the one 20gb disk currently, which is under the logical volume named /dev/mapper/Mega-root – this is what we will be expanding with the new disk.


Note that /dev/mapper/Mega-root is the volume made up from /dev/sda5 currently – this is what we will be expanding.

Adding a new virtual hard disk

First off we add a new disk to the virtual machine. This is done by right clicking the virtual machine in vSphere, selecting edit settings and then clicking the “Add…” button which is used to add hardware to the virtual machine.

Select hard disk and click next.



Select create a new virtual disk and click next.



Select the disk size you want to add, I will be using 20gb as previously mentioned. I have also selected to store the disk with the virtual machine, it will store on the same datastore as the virtual machines files, this will be fine for my test purposes. Click next once complete.



Select next on the advanced options page.



Review everything and click finish once you have confirmed the settings.



You will then see the new disk under the hardware devices tab and it will be labelled with (adding) which means it will not apply until you click OK, so click OK to complete the process.



Detect the new disk space

In my test for this example, as soon as I added the additional disk in through VMware it displayed through “fdisk -l” for me, you can see the second disk labelled /dev/sdb (I have cropped out the information on /dev/sda1 to make it less cluttered here). It is also worth noting that it shows as not containing a valid partition table, we are about to set this up.



This may not however be the case for you, to avoid reboot you may need to rescan your devices, you can try this with the below command. Note that you may need to change host0 depending on your setup.

echo "- - -" > /sys/class/scsi_host/host0/scan

If you have issues detecting the new disk, just perform a reboot and it should then display correctly.

Partition the new disk

We now need to partition the new /dev/sdb disk so that it can be used, this is done by using fdisk.

fdisk /dev/sdb

This should provide us with the below prompt, the inputs I have entered in are shown in bold.

‘n’ was selected for adding a new partition.

root@Mega:~# fdisk /dev/sdb
Command (m for help): n

‘p’ is then selected as we are making a primary partition.

Command action
   e   extended
   p   primary partition (1-4)

As this is a new disk, we do not yet have any partitions on it so we will use partition 1 here.

Partition number (1-4): 1

Next we press the enter key twice, as by default the first and last cylinders of the unallocated space should be correct.

First cylinder (1-2610, default 1): "enter"
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): "enter"
Using default value 2610

‘t’ is selected to change to a partitions system ID, in this case we change to ’1′ automatically as this is currently our only partition.

Command (m for help): t
Selected partition 1

The hex code ’8e’ was entered as this is the code for a Linux LVM which is what we want this partition to be, as we will be joining it with the original Linux LVM which is currently using /dev/sda5.

Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

‘w’ is used to write the table to disk and exit, all changes that have been done will be saved and then you will be exited from fdisk.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

By using “fdisk -l” now you will be able to see that /dev/sdb1 is listed, this is the new partition created on our newly added /dev/sdb disk and it is currently using all 20gb of space.


Increasing the logical volume

Next we will use the pvcreate command to create a physical volume for later use by the LVM. In this case the physical volume will be our new /dev/sdb1 partition.

root@Mega:~# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

Now we need to confirm the name of the current volume group using the vgdisplay command. The name will vary depending on your setup, for me it is the name of my test server. vgdisplay provides plenty of information on the volume group, I have only shown the name and the current size of it for this example.

root@Mega:~# vgdisplay
  --- Volume group ---
  VG Name               Mega
  VG Size               19.76 GiB

Now using the vgextend command, we extend the ‘Mega’ volume group by adding in the physical volume of /dev/sdb1 which we created using the pvcreate command just before.

root@Mega:~# vgextend Mega /dev/sdb1
  Volume group "Mega" successfully extended

Using the pvscan command we scan all disks for physical volumes, this should confirm the original /dev/sda5 partition and the newly created physical volume /dev/sdb1

root@Mega:~# pvscan
  PV /dev/sda5   VG Mega   lvm2 [19.76 GiB / 0    free]
  PV /dev/sdb1   VG Mega   lvm2 [19.99 GiB / 19.99 GiB free]
  Total: 2 [39.75 GiB] / in use: 2 [39.75 GiB] / in no VG: 0 [0   ]

Next we need to increase the logical volume with the lvextend command (rather than the physical volume which we have already done). This means we will be taking our original logical volume and extending it over our new disk/partition/physical volume of /dev/sdb1.

Firstly confirm the name of the logical volume using lvdisplay. The name will vary depending on your setup.

root@Mega:~# lvdisplay
  --- Logical volume ---
  LV Name                /dev/Mega/root
  LV Size                18.91 GiB

The logical volume is then extended using the lvextend command. We are extending the original logical volume of /dev/Mega/root over the newer /dev/sdb1

root@Mega:~# lvextend /dev/Mega/root /dev/sdb1
  Extending logical volume root to 38.90 GiB
  Logical volume root successfully resized

If you like you can then run vgdisplay and lvdisplay again to confirm the size of the volume group and logical volume respectively, I have done this and I now have the following.

  LV Size                38.90 GiB
  VG Size                39.75 GiB

However if you run a “df” command to see available disk space it will not have changed yet as there is one final step, we need to resize the file system using the resize2fs command in order to make use of this space.

root@Mega:~# resize2fs /dev/Mega/root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/Mega/root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/Mega/root to 10196992 (4k) blocks.
The filesystem on /dev/Mega/root is now 10196992 blocks long.

This took a minute or so to complete, running the “df” command now shows the correct disk space for /dev/mapper/Mega-root



Do fotogalerie jsem přidal pár fotek novoročního ohňostroje v Praze ze dne 1.1.2013.


Do fotogalerie do alba Turanj přidáno 20 nových fotografií pořízených v září 2012.

HDR fotografie

Tak jsem neodolal a vyzkoušel jsem HDR fotografii. Fotil jsem v Praze a použil jsem expoziční bracketing (-2,0,+2).

Takto pořízené fotografie jsem následně spojil do jedné pomocí programu Photomatix.

Další fotografie jsou k vidění zde.

Přidal jsem do fotogalerie fotky zříceniny hradu Lichnice, které jsem tam pořídil v létě 2011.

Lichnice či Lichtenburk je zřícenina hradu v Železných horách, nacházející se na skalnatém návrší v nadmořské výšce 480 m n.m. nad městem Třemošnice. Leží při hranici Národní přírodní rezervace Lichnice – Kaňkovy hory a je součástí CHKO Železné hory.

Hrad Lichnice má tvar pravidelného trojúhelníku o rozměrech 120 × 110 × 80 metrů. 110 metrová východní část byla opatřena bránou s přístupovou cestou a byla chráněna mohutným příkopem s valem. Příkop se táhl i pod jihozápadní 120 metrovou stranou. Severní strana byla chráněna Lovětínskou roklí.



Zajímavý tip na místo, kde lze udělat zastávku při cestě autem do Chorvatska – obec Turanj.

V tomto městečku, které leží jižně od města Karlovač, (střední část Chorvatska), je jedno ze dvou vojenských muzeí otevřených pro veřejnost v Chorvatsku.

Turanj Na Korani je historická základna na jih od rakousko-uherské pevnosti Karlovač, která byla založena v roce 1582 u řek Korana a Mreznica jako strážný bod proti tureckým nájezdům. Vzhledem ke své strategické poloze, bylo toto místo pod vojenskou správou pro dalších pět století a to i během občanské války v letech 1991-1995.

Tento malý skanzen založil vysloužilý důstojník chorvatské armády v roce 2003.
Nachází se v bývalém dvorku zničené vojenské základny. Místo ještě jasně vykazuje známky poškození (jako mnoho jiných domů v okolí).
Muzeum je určeno nejen pro zobrazení zbraní používaných v chorvatské armádě během poslední války, ale také k uchování vzpomínky na lidi, kteří obětovali své životy, aby bránili svou vlast a své město.


Pozornost každého pravděpodobně jako první upoutá originální stíhací letoun MiG-21bis z chorvatského letectva (Hrvatske Zracne Snage, HZS).
Letadlo je ve výborném stavu a je v původních barvách, tak jak byl v roce 1995 u HZS. Je vyzbrojen raketomety UV-32-57 a UV-16-57.



Ještě je tu k vidění jeden letoun, přesněji vrak letounu. Jedná se opět o MiG-21bis, který byl sestřelen dne 6. listopadu 1991, poblíž obce Slunj. Podle seriového čísla 17130 je známo, že letadlo sloužilo u 117. pluku bývalého jugoslávského letectva a protivzdušné obrany (Ratno Vazduhoplovstvo i Protivvazdushna Odbrana – JRViPVO).



Zvláštní místo je vyhrazeno pro dva “domácí” obrněné transportéry. Menší ze dvou, “M-91 Straško”,
byl vlastně obrněný traktor, vyzbrojený kulometem německé výroby – MG42.

Druhým je “M-91 Sveti Juraj” vůz upravený v podobně. A i přes relativně čerstvou vrstvu barvy, je ještě vidět jasná stopa po zásahu granátem RPG-7 nad dveřmi řidiče.


Další poutavá část tohoto muzea je řada obrněných vozidel používaných v chorvatské armádě během války. Obsahuje například tank T-55, M4A3 Sherman (pravděpodobně varianta Firefly s delším 76mm dělem), jeden M36 Jackson tank. Dále jsou zde   kanon M3A-1 Flak ráže 94mm,  ZIS M42 – ruský protitankový kanón ráže 76 mm a dva britské 6Pdr ráže 57mm.









Návštěvu tohoto muzea mohu jedině doporučit.

GPS souřadnice:  45.462971   15.567057

Praha v noci – 1. část

První fotografii není snad potřeba ani popisovat. Jedná se o pohled na Pražský hrad a Karlův most z Novotného lávky.

Pražský hrad je asi nejvýznamnější a nejznámější český hrad nad řekou Vltavou v centru Prahy. Býval sídlem českých knížat, později králů a od roku 1918 je sídlem prezidenta republiky. Postupnými přístavbami a úpravami vznikl z hradiště založeného v 9. století jeden z největších hradních komplexů na světě. Hrad je často považován za symbol města i České republiky. Součástí hradu je Katedrála svatého Víta, tradiční místo korunovací českých králů i jejich posledního odpočinku. Karlův most je nejstarší stojící most přes řeku Vltavu v Praze a druhý nejstarší v České republice. Karlův most nahradil předchozí Juditin most, stržený roku 1342 při jarním tání ledů. Stavba nového mostu začala v roce 1357 pod záštitou krále Karla IV. a byla dokončena v roce 1402. Most byl postupně ozdoben jednatřiceti sochami a sousošími.


Staroměstská mostecká věž je považována za jednu z nejkrásnějších gotických staveb v Evropě. Nachází se v Praze na Starém Městě na Křižovnickém náměstí při pravobřežním vstupu na Karlův most na královské cestě. Jedná se o gotickou věž postavenou společně s mostem Petrem Parléřem. Věž nad prvním mostním pilířem Karlova mostu má tvar třípatrového hranolu s cimbuřím a vysokou stanovou střechou pokrytou břidlicí. Na jižní straně se nachází hranolovitý přístavek se schodištěm a vlastní střechou, kudy vede vstup do vyšších pater věže. Na ochoz věže se dostaneme po 138 schodech. Výška věže činí 47 metrů nad rovinou mostu, nad hladinou Vltavy je to 57 metrů. Nárožní věžičky se nacházejí ve výšce 64 metrů.


  Malostranské mostecké věže jsou dvě stylově odlišné nestejně vysoké věže, propojené branou, tvořící vstup z Karlova mostu na Malou Stranu na královské cestě na počátku Mostecké ulice. Nižší z obou věží se také nazývá Juditina věž, protože byla součástí Juditina mostu, předchůdce dnešního mostu Karlova. Byla zbudována z kvádříkového zdiva v románském slohu v druhé polovině dvanáctého století. Zhruba na místě původní druhé románské mostecké věže byla zbudována nová, gotická věž. Její základy byly postaveny na začátku 15. století, ale vzhledem k bouřlivému husitskému období bylo ke stavbě přistoupeno až za Jiřího z Poděbrad v roce 1464. Věž je zřetelně inspirována parléřovskou Staroměstskou mosteckou věží, ale chybí zde náročná symbolika sochařské výzdoby, výklenky pro sochy na západní a východní straně věže zůstaly prázdné. Dnešní podoba věže pochází z let 1879-83, kdy došlo k její obnově architektem Josefem Mockrem.


Socha Bruncvíka není umístěna přímo na Karlově mostě, stojí mimo řadu soch na podstavci. Autor ji vytesal v kombinaci vlastní představy a podle fragmentu sochy z 15. století. Socha symbolizuje rytíře s taseným mečem, se lvem u nohou a erbem po boku.  Legenda o Bruncvíkovi vypráví, že se vydal do cizích zemí vydobýt si právo na vylepšený erb s vyobrazením lva místo dosavadní černé orlice. Lva na svých cestách opravdu potkal a podařilo se mu ho zachránit před drakem. Bruncvík vlastnil kouzelný meč, který podle pověsti sám srážel hlavy nepřátelům. Po návratu domů ho zakopal na Karlově mostě. Má ho vyzvednout sv. Václav v místě, kde jeho kůň kopytem rozkopne zem na mostě při cestě na pomoc české zemi. Meč zničí nepřátele a bude navždy klid v Čechách.


Mým posledním dnešním zastavením je Hanavský pavilon, který se nachází v Letenských sadech. Původně to byl výstavní pavilon komárovských železáren na Jubilejní výstavě roku 1891 postavený v novobarokním slohu podle návrhu Zdeňka Fialy. V roce 1898 byl pavilon přemístěn na dnešní místo do Letenských sadů. Rekonstruován byl v letech 1966 až 1968. V současné době je v objektu restaurace.





Zdroj informací:



Do fotogalerie přidány fotografie ohňostroje, který se konal 8.října 2011 u příležitosti Pardubických městských slavností.

dsc_2629 dsc_2344 dsc_2581

towerVojenský výcvikový prostor byl založen roku 1904, rakouská armáda zde zabrala přes 3000 ha půdy, na vytvořeni cvičiště pro velká polní cvičení, byla zde i střelnice. Během 1. světové války zde byli drženi italští a ruští zajatci.  Prostor využívala též armáda za  1.republiky. V té době bylo rozhodnuto o likvidaci obce Mladá, jejíž obyvatelstvo bylo přesídleno. Ruiny vesnice později posloužily při cvičné střelbě. Od roku 1921 je v provozu též vojenská železniční trat z Lysé nad Labem, uváděná dnes pod číslem 232. Mezi válkami zde bylo zřízeno i vojenské letiště Boží Dar

Od roku 1939 prostor využívala německá armáda, dokonce se zde natáčely i filmy německé válečné propagandy, které pak byly ve filmových týdenících vydávány za záběry z východní fronty. Ke konci války se sem dostávaly vojenské pluky, utíkající před rudou armádou do amerického zajetí, byl zde i obrněný vlak, kterým se během pražského povstání vojáci SS snažili zasáhnout do bojů v Praze. Po roce 1945 se zde usídlila československá armáda a to ažflat do roku 1969, kdy byla nahrazena sovětským vojskem, tzv. Střední skupina vojsk, která zde dokonce měla své ústředí ČSSR. Pro potřeby sovětské armády byl denně vypravován z Milovic do Moskvy speciální vlak. V roce 1991 prostor vojska zcela opustila, zůstalo zde obrovské množství opuštěných vojenských i civilních objektu, včetně zmiňovaného letiště. Z větší části byly tyto stavby brzy zdevastovány a jejich vybavení rozkradeno.

V současnosti je celý areál vojenského prostoru volně přístupný včetně letiště. Toto letiště slouží pro provoz ultralehkých sportovních letadel, pořádají se zde též srazy tuningu nebo hudební akce.



Zdroj informací: