$ find / -size +100000k -exec ls -lh '{}' \;
Monday, June 2, 2008
Find your most sized files
It is very easy with 'find' unix tool:
Thursday, April 24, 2008
Hard disk benchmark
HD benchmarking is easy with bonnie++
Change 6600 to two times your ram to get a good result.
# apt-get install bonnie
# mkdir /store/bench
# chown randradas:randradas /store/bench & chmod 755 /store/bench
# bonnie++ -d /store/bench -s 6600 -x 5 -u randradas:randradas -q -f 2>&1 | tee bonnie++.LOG &
Change 6600 to two times your ram to get a good result.
Tuesday, April 15, 2008
Forwarding proxy with Apache
Edit prx.confwith the next Apache directives and adapt it to your port and directory requirements:
Run the proxy with as normal user:
And then connect to the proxy from your http client, the server is listening in the 8887 port.
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so
Listen 8887
ProxyRequests On
#put < and > to the next directive
Proxy *
Order Deny,Allow
Deny from all
Allow from 10.0.0.0/24
#put < and > to the next directive
/Proxy
LogLevel warn
CustomLog /home/randradas/prx/access.log combined
ErrorLog /home/randradas/prx/error.log
PidFile /home/randradas/prx/apache.pid
Run the proxy with as normal user:
$ /usr/sbin/apache2 -f prx.conf
And then connect to the proxy from your http client, the server is listening in the 8887 port.
Wednesday, April 2, 2008
Resize Xen disk image
losetup -f
losetup /dev/loop0 disk.img
e2fsck -f /dev/loop0
resize2fs /dev/loop0 6G
resize2fs 1.40-WIP (14-Nov-2006)
Resizing the filesystem on /dev/loop0 to 1572864 (4k) blocks.
The filesystem on /dev/loop0 is now 1572864 blocks long.
e2fsck -f /dev/loop0
losetup -d /dev/loop0
losetup /dev/loop0 disk.img
fsck -n /dev/loop0
fsck 1.40-WIP (14-Nov-2006)
e2fsck 1.40-WIP (14-Nov-2006)
/dev/loop0: clean, 112769/786432 files, 458389/1572864 blocks
eddard:/xens/domains/beta.osor.eu# tune2fs -O ^has_journal /dev/loop0
tune2fs 1.40-WIP (14-Nov-2006)
eddard:/xens/domains/beta.osor.eu# e2fsck -f /dev/loop0
e2fsck 1.40-WIP (14-Nov-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/loop0: 112769/786432 files (0.6% non-contiguous), 425587/1572864 blocks
For example, to create a 2GB sparse file-backed virtual block device (actually only consumes 1KB of disk):
# dd if=/dev/zero of=vm1disk bs=1k seek=2048k count=1
Make a file system in the disk file:
# mkfs -t ext3 vm1disk
(when the tool asks for confirmation, answer `y')
Populate the file system e.g. by copying from the current root:
# mount -o loop vm1disk /mnt
# cp -ax /{root,dev,var,etc,usr,bin,sbin,lib} /mnt
# mkdir /mnt/{proc,sys,home,tmp}
Tailor the file system by editing /etc/fstab, /etc/hostname, etc. Don't forget to edit the files in the mounted file system, instead of your domain 0 filesystem, e.g. you would edit /mnt/etc/fstab instead of /etc/fstab. For this example put /dev/sda1 to root in fstab.
Now unmount (this is important!):
# umount /mnt
In the configuration file set:
disk = ['file:/full/path/to/vm1disk,sda1,w']
Friday, March 7, 2008
Export X11
Scenario: Mac OS X (nieve)/server, Debian Etch (stark)/client
Objetive: Run a X application in my Mac OS
Now you have Evolution running in your X11 server.
Objetive: Run a X application in my Mac OS
- Run X11 in Mac OS
- Open a terminal:
nieve:~$ xhost +stark_ip (this step allows your client to connec to your server)
nieve:~$ ssh -X randradas@stark_ip
..
..
Welcome to stark
..
stark:~$ export DISPLAY=nieve_ip:0.0
stark:~$ evolution &
Now you have Evolution running in your X11 server.
Thursday, February 21, 2008
Apache2+SSL+SVN
# apt-get install apache2 openssl ssl-cert
# mkdir /etc/apache2/ssl
# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache2.pem
# chmod 600 /etc/apache2/ssl/apache.pem
# cd /etc/apache2/sites-available/
# cp default ssl
# a2ensite ssl
# a2enmod ssl
# vim /etc/apache2/ports.conf
..
Listen 443
..
# vim /etc/apache2/sites-available/svn
..
NameVirtualHost *:443
VirtualHost *:443
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
..
VirtualHost
# /etc/init.d/apache2 restart
At this point you have an Apache server with SSL. Follow the next commands in order to integrate svn with Apache+SLL
# cd /
# mkdir /svnroot
# chown www-data /svnroot/
# su www-data -c "svnadmin create /svnroot/repository"
# su www-data -c "htpasswd -c -m /svnroot/.dav_svn.passwd testuser"
..
..
# vim /etc/apache2/sites-available/svn
..
Location /svn
DAV svn
SVNParentPath /svnroot/
AuthType Basic
AuthName "LibreForge Subversion Repository"
AuthUserFile /svnroot/.dav_svn.passwd
Require valid-user
Location
..
# /etc/init.d/apache2 restart
Now you can use your repository with the testuser created recently:
$ svn co https://your.domain.tld/svn/repository
$ cd repository
$ touch testfile
$ svn add testfile
$ svn ci -m "restfile added"
Or see your repository through https, https://your.domain.tld/svn/repository
Saturday, January 5, 2008
Google hack
You can search indexed directories with Google using the next chain:
-inurl:(htm|html|php) intitle:"index of" +"last modified" \
+"parent directory" +description +size +(avi|mpg) "Kickboxer"
Subscribe to:
Posts (Atom)