The Sky is not the limit

Entries from August 2008

How to use parted for creating patition larger that 2 TB ?

August 23, 2008 · 3 Comments

To create partitions larger than 2TB we need to use GPT labels. Standard fdisk doesn’t understand GPT labels so we need to use parted.

Here we are going to partition the disk /dev/sdb

root@localhost ~> parted /dev/sdb

This will bring up parted.  Type help to view the commands in parted prompt.

(parted) help
check NUMBER                             do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition
help [COMMAND]                           prints general help, or help on COMMAND
mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partititon NUMBER
mkpart PART-TYPE [FS-TYPE] START END     make a partition
mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system
move NUMBER START END                    move partition NUMBER
name NUMBER NAME                         name partition NUMBER as NAME
print [free|NUMBER|all]                  display the partition table, a partition, or all devices
quit                                     exit program
rescue START END                         rescue a lost partition near START and END
resize NUMBER START END                  resize partition NUMBER and its file system
rm NUMBER                                delete partition NUMBER
select DEVICE                            choose the device to edit
set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
unit UNIT                                set the default unit to UNIT
version                                  displays the current version of GNU Parted and copyright information

root@localhost ~> parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

To change the label to gpt we run the following command:

(parted) mklabel gpt

Next run the print command: This will list the disk geometry. Please note the size listed:

(parted) print

Model: Adaptec raid5-1 (scsi)
Disk /dev/sdb: 10.7TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags

This will tell us where to start and end the partitions. To create one huge partition ( 8 Tb = 8388608 bytes) run the following commands:

(parted) mkpart primary 0 8388607.000

The command reads as make a primary partition, start at 0 and end at 8388607.000

Also, if you are making a partition for a device smaller than the limit from the notes below, you can use the following if the geometry doesn’t show like it does above. Just exit out of parted, and run this from a shell:

root@localhost ~> parted -s — /dev/sdb  mkpart primary ext3 0 -1

This will take the whole disk for creating the partition.

The parition has been created and now you can quit parted:
(parted) quit

Now all that has to be done is to format the partition:(the -m swith tells mkfs to only reserve 1% of the blocks for the super block)

root@localhost ~> mkfs.ext3 -m1 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1024000000 inodes, 2047999751 blocks
20479997 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
62500 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount the disk

root@localhost ~> mount /dev/sdb1 /disk1

root@localhost ~> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             240G  2.3G  225G   2% /
/dev/sda1             996M   45M  900M   5% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/sdb1             7.6T  177M  7.5T   1% /disk1

Now edit /etc/fstab to mount the partiton automatically on boot.

root@localhost ~>vi /etc/fstab

Add the following  line  in /etc/fstab

/dev/sdb1     /disk1   ext3    defaults        0 0

Reference :-  http://www.gnu.org/software/parted/manual/html_mono/parted.html

Categories: Linux tutorials
Tagged: , , , , ,

Installation of FFmpeg + FFmpeg-PHP +Lame + Ruby + Mplayer + Mencoder + flv2tool

August 11, 2008 · 1 Comment

FFmpeg is a computer program that can record, convert and stream digital audio and video in numerous formats. FFmpeg is a command line tool that is composed of a collection of free software / open source libraries. It also supports grabbing and encoding in real time from a TV card.

=====================================================================

To install ffmpeg in Debian and Ubuntu servers please refer to the following URL.

http://linux.justinhartman.com/FFmpeg,_FFmpeg-PHP,_Lame,_Libogg,_Libvorbis,_FLVtool2,_Mplayer,_Mencoder,_AMR_Installation

=====================================================================


Go to your installation folder.

cd /usr/local/src

1. Lame MP3 encoder

Pure install of FFmpeg is not enough, the FLV (Flash Video Files) converted has no audio, because FLV audio codec is mp3, so you need LAME support.

Download from sourceforge.net

wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.96.tar.gz
tar xvzf lame-3.96.tar.gz
cd lame-3.96
./configure –enable-shared –prefix=/usr
make
make install

enable-shared to make sure FFmpeg can use LAME later. Type lame in command line to see help after install succeed.

Go to your installation folder.

cd /usr/local/src

2. Install subversion via yum, rpm or up2date (things are easier with Subversion).

For eg: If the server has yum installed, the following command would suffice.

yum install subversion

3. Download ffmpeg using subversion

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

cd ffmpeg


./configure –enable-gpl –enable-shared –enable-libmp3lame

==============================
If you are getting the following error

“Unable to create and execute files in /tmp. Set the TMPDIR environment…”
Try to unmount /tmp OR

mkdir /test ; chmod 777 /test
vi configure edit TMPDIR to /test

and execute it once again

====================
make
make install

Go to your installation folder.

cd /usr/local/src

4. Install Ruby (FLVTool2 is written in Ruby, so you have to install Ruby in server too)

FLVTool2 is a manipulation tool for Macromedia Flash Video files (FLV). It can calculate a lot of meta data, insert an onMetaData tag, cut FLV files, add cue points (onCuePoint), show the FLV structure and print meta data information in XML or YAML.

Download from Ruby site, type the following command to compile and install it:

./configure
make
make install

Note: if you have yum installed, just use

yum install ruby

Go to your installation folder.

cd /usr/local/src

5. Install FLVTool2

Download from FLVTool2 site, type the following command to compile and install it:

wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
tar xvzf flvtool2_1.0.5_rc6.tgz
cd flvtool2_1.0.5_rc6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

Type flvtool2 in command line to see help after install succeed.

Go to your installation folder.

cd /usr/local/src

6. Install ffmpeg-php

wget http://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2?modtime=1213135005&big_mirror=0
tar xjvf ffmpeg-php-0.5.3.1.tbz2
cd ffmpeg-php-0.5.3.1

phpize
./configure && make
make install

You will get a message as follows, which mention the path

############################
/usr/local/src/ffmpeg-php-0.5.3.1/modules/ffmpeg.so
cp ./.libs/ffmpeg.lai /usr/local/src/ffmpeg-php-0.5.3.1/modules/ffmpeg.la
PATH=”$PATH:/sbin” ldconfig -n /usr/local/src/ffmpeg-php-0.5.3.1/modules
———————————————————————-
Libraries have been installed in:
/usr/local/src/ffmpeg-php-0.5.3.1/modules

Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
########################

This creates the ffmpeg.so file. Include this extension in your php.ini file.
extension=ffmpeg.so

You can find the php.ini that the the server is using with the following command.

php -i |grep php.ini

Make sure that the php.ini has the above mentioned extension directory. Also note the PATH where the shared libraries loaded.

Go to your installation folder.

cd /usr/local/src

7. Libogg + Libvorbis

Download libogg from http://downloads.xiph.org/releases/ogg/

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
tar xvzf libogg-1.1.3.tar.gz
cd /usr/local/src/libogg-1.1.3
./configure && make && make install

Go to your installation folder.

cd /usr/local/src

Download Libvorbis from http://downloads.xiph.org/releases/ogg/

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
tar xvzf libvorbis-1.1.2.tar.gz
cd /usr/local/src/libvorbis-1.1.2
./configure && make && make install

Go to your installation folder.

cd /usr/local/src

8. Mplayer & Codecs

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar xjvf essential-20071007.tar.bz2
mv /usr/local/src/essential-20071007/ /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

Go to your installation folder.

cd /usr/local/src


wget http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2
tar xjvf MPlayer-1.0rc1.tar.bz2
cd MPlayer-1.0rc1/
./configure
make
make install

=======================

For more information and FAQs,

http://ffmpeg.mplayerhq.hu/faq.html

Click here for the steps to install FFmpeg and FFmpeg-php in a Linux ( RHEL, CentOS, Fedora) Server.

Common Issues & fixes :

1) If you are getting the following error while running ffmpeg in shell, try the following.

ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

A)
Step 1: Check if the file “libavdevice.so.52″ exists in the server using the following command.

find / -name ‘libavdevice.so.*’

Step 2: You will get the directory in which the file “libavdevice.so.52″ exists from the above command.
Suppose the directory is “/usr/local/lib/” in this example.

Step 3: You have to add the directory name in the file “/etc/ld.so.conf”.

Step 4: Execute the command “ldconfig”.

OR

B)
export LD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH

But this value will be cleared once you log off that session.

So it is better to save this value in bashrc

vi .bashrc
LD_LIBRARY_PATH=/usr/local/lib

After closing the file execute the command : bash

2)

If you are getting the following errors while installing ffmpeg

checking for ffmpeg headers... configure: error: ffmpeg headers not
found. Make sure you've built ffmpeg as shared libs using the --enable-
shared option 

Check whether “/usr/local/include/ffmpeg” directory is created while installing ffmpeg. If not, create this directory.

mkdir /usr/local/include/ffmpeg

Copy the necessary ffmpeg header files to “/usr/local/include/ffmpeg”.

cp -p /usr/local/src/ffmpeg/libavformat/avio.h /usr/local/include/ffmpeg
cp -p /usr/local/src/ffmpeg/libavformat/avformat.h /usr/local/include/ffmpeg
cp -p /usr/local/src/ffmpeg/libavcodec/avcodec.h /usr/local/include/ffmpeg

Categories: Linux tutorials · Plesk · cPanel
Tagged: , , , , , , , , , , ,

How to change RDP listening port in Windows 2003 server?

August 5, 2008 · Leave a Comment

In order to modify the RDP listening port,  follow the steps mentioned below.

1) Run REGEDIT on your Server.

Start >> Run >> regedit and hit Enter

2) Export the following key: (Right click and export)


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

3) Edit the REG file and change the name of the key to something like:


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp-New

4) In the REG file find


PortNumber


and change it to whatever port you want.
(right click and modify)

5) Import the REG file back to the registry.

You can now connect to the new port by using the Windows Terminal Server client.

To Alter the Port on the client side:

1) Go to the Start menu and click on Run.

2) On the Run menu type mstsc and click Enter.

Note: To use RDP on computers with operating systems other than Windows XP/2003 you will first need to install the RDP client.

3) In the RDP window, in the Computer box, scroll to the computer name or IP to which you wish to connect.

4) Add a :P ort(without the quotes) where “Port” is the decimal value of the destination port.

5) Press Connect.

Another method of connecting to a different port that default is to run the MSTSC command with the required command line parameters:
/v:ServerName[:Port]

For example: MSTSC /v:192.168.0.191:3390

=================

For more information : http://support.microsoft.com/kb/555031/en-us

Categories: Windows
Tagged: