Linux - determine the block size of ext3 filesystem

Simple ... when you know it

Just use the command tune2fs with the -l option and followed by the name of the device.

$> tune2fs -l /dev/VolGroup00/LogVol00 | grep -i "block size'

Create Filesystem on OEL

Just as a documentation thing...

1.Partition the device

Use fdisk to add/delete/modify partitions.
Start it by specifying the device name after fdisk:
ex. fdisk /dev/hdb
The result of this will be that you allocated the space on the device to a set of partitions (/dev/hdb1, ... )
This you can see when looking in the /dev directory. The partitions you created should be defined in it.

2. Create a filesystem on the partition(s)
This can be done by issueing the mkfs command.
You have to specify the type of filesystem at the -t option.
For example: mkfs -t ext3 /dev/hdb1

3. Mounting the filesystem
Two possible ways to do this:
- on a permanent basis 3.b.
- on a use base : 3.a.

3.a. Mount the filesystem permantently
This is achieved by defining the partition and mount point in the fstab file.
In there you will enter a line per partition to be mounted with the systemboot.
See man fstab for details on what theline should look like.

3.b. Mount the filesystem on a use base
Just launch the command mout to mount the filesystem on the location you want.
The location must be a directory.
ex: mount -t ext3 /dev/hdb1 /MyNewPartition

3.c for completeness ... unmounting the filesystem
You can do this by issueing the umount command followed by the mount point
ex. umount /MyNewPartition

Shrink size of a LVM Volume Group

The next things are a very short resume of an article on how to shrink a Logical Volume group by using the rescue mode of the installation disk.

The article itself can be found at http://forums.fedoraforum.org .

The context is Redhat or Oracle Enterprise Linux.

In order to shrink an LVM volume group the only prerequisite is that you have the installation media.

1. Verify the content in advance of the logical volume group.
This can be done via the volume management tool (graphical) where you see the layout of the filesystems, or simply by using df -h on the command line. Verify the space that is in effect used in the filesystem.

2. Launch the rescue mode.
This can be achieved by booting the machine using the installation media of Redhat/Fedora/Oracle linux.
The option to launch the rescue mode is documented in the startup screen. See F2 for more informaiton after booting from the dvd/cd.
On the command prompt enter "linux rescue".
Enter the language, keyboard and network parameters. The network is not required to be available.

3. identify the filesystems to be unmounted
Typically the existing filesystems will be mounted in rescue mode in
/mnt/sysimage.
Use df -h to see a list of filesystems.

4. unmount the filesystems
Execute an umount for each of the filesystems named /mnt/sysimage/* ending with the /mnt/sysimage itselve.

5. Identify the volumegroup
Two options here:
- you looked closely to the df -h output
- you look in the /dev directory to identify the structure of the volumegroup.

6. Check the logical volumes.

Perform an e2fsck on the logical volume:
$> e2fsck -f /dev/VolGroup00/LogVol00
At the end of the command the statistics show the usage of the filesystem.

7. Resize the filesystem.
Execute resize2fs to move all files in a consistent way to the beginning of the device.
resize2fs /dev/VolGroup00/LogVol00 3G
The 3G is the indication of the size that will be used for the filesystem after the operation.

8. Release not used space.
This will physically change the size of the partition occupied.
Some OS's do not have an lvm command shell but all commands have to be passed to lvm. This is something that was not documented in the original article.
To know the existence of the lvm shell, simply type lvm. If you enter the shell ... there is one, obvious. All commands can be taken as in the original article. In the other case - so no lvm shell exists - you will need to use the command format lvm .
To resize execute the following command (for the shell way, refer to the original article).
Execute the command:
lvm lvresize --size 3G /dev/VolGroup00/LogVol00
The endpoint (cilinder) of the partition will change.

9 exit the rescue mode and restart.
This should be the most easy command ...

Tested the procedure on a OEL virtual machine running under VMWare Fusion 3 on an Apple MacBook Pro.

Me.

iSCSI configuration on OEL

Intro

This entry is, or will hopefully become, a resume of a number of articles I read in the course of understanding and configuring iSCSI on Oracle Enterprise Linux (OEL). So ... first the links to different documents I found interesting (hopefully the links remain working)
The section on the configuration will suppose you know iSCSI terminology ... which requires you not to be a novice on this subject ... or having read the documents referred to under the section 'Links' ;-)

Links



Configuration of the iSCSI targets on OEL


Configuration of the iSCSI Initiator on OEL





nfs on enterprice linux - to be continued

This is just a resume from the things I read in some articles and things I experience while applying them.

0. Point Zero
Some considerations are in place.
NFS stands for Network File System, or ... you need a network and you need a filesystem to be shared. This latter is in a certain way a big limitation of the possibilities of NFS. it is not possible to share a subdirectory of a filesystem.

a. Use an nfs share

a.1. verify the portmapper is running
To do this run
rpcinfo -p
The portmapper should be in the list that is returned.

a.2. Mount the share
Just use the mount command telling the type of drive is nfs and the location where to find the share and how the share is called.
$> mount -t nfs :
example:
mount -t nfs mynfsserver:software /remoteshares/software
The location must exist upfront.

To unmount
$> umount

b. Create an nfs share

b.1. define the shares that may be exported
The shares are defined in the /etc/exports file.
Look to this location for information on the possible options.
A very simple example of the file
/Software *.hellings.be(ro)
/Share *.hellings.be(rw,all_squash,anonuid=100,anongid=100)

use exportfs to update the mountd tables.
$> exportfs -rav

b.2. (re)start the nfs server
This depends on how nfs has been installed.
If installed as a service use
service nfs restart

c. Mounting nfs shares at boot time

A line should be added to the fstab file in /etc.
Look in the referenced articles for further details.
It should look something like
: nfs rw 0 0
nfs is the type of filesystem
rw can be elaborated with a lot of other options
0 (this is the number zero) is the dump indicator
0 (again ... zero) is the fsckorder flag.

d. What about permissions on nfs share drives?

Not investigated yet .... sorry ...
The only thing is that you can set a 'replacement' user and group on the level of the nfs-share definition in the /etc/exports file, using the anonuid and anongid options. this in combination with all_in_squash option.

e. References
This is the original article

NFS reference pages
...

vncserver on enterprise linux

In order to have a vnc graphical desktop to your server do the following:

Check if vncserver exists.
If not ... install the package (see other forums)
If installed:

Connect to the unix box as the user that needs to be connected to the linux box via the vncserver.

Step1: init vncfiles for user
Launch the command vncserver.
This will create the required files and config settings in the users home directory.
You will notice the reference of a desktop id, something like :1
Use this referenct to stop the vncserver again by issueing the following command:
vncserver -kill :1

Step2: Enable X for the users remote desktop
Go to the home directory ( simply cd )
Go to the .vnc directory
Edit the file xstartup by uncommenting two lines:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
so that you get
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
Save the file.

Step3: Initialise the vnc password
Launch the command vncpasswd.
Enter two times the password.
This will initialise the password for the user via which you will be connecting

Step 4: Start vncserver again
This step is only required if you want to run vnc not as a service but for restricted time periods.
Issue the command vncserver
Look at the reference the vncserver indicates, eg :1 or something like it.
Make a connection by a vncviewer using the host:reference

Step5: configure the service
Connect as root user
Go to the directory /etc/sysconfig
Modify the file vncserver as root user.
Look at the bottom of the file and duplicate the two lines.
In the pasted lines:
  • uncomment them (remove the # character)
  • in the line VNCSERVERS change the myusername by the user under which you created in steps 1 to 3 the config files
  • In the line VNCSERVERARGS remove the option -localhost
    This would prevent you from connecting from an other host.
(Step 6: What if you need different vnc servers with different users)
This step is optional.
Basically this is very easy.
Just perfom Steps 1 to 3 for each unix user you want to make available via vnc.
So
  • connect as the unix user on the box
  • start vncserver, defaulting the vnc-password of that user
  • stop the vncserver
  • go to directory ~/.vnc
  • uncomment the two lines in the xstartup file
The tricky bit is located in the startup script for the vncserver service. (step 5)
The first line should contain a list of the different displays with the corresponding unix users.
The second line should be repeated for every display that you entered in the list of displays in the first line. For each of the displays specific settings can be done.
The next is an example of two displays with two users:

VNCSERVERS="1:oracle 2:defaultuser"
VNCSERVERARGS[1]="-geometry 1200x1024 -nolisten tcp -nohttpd"
VNCSERVERARGS[2]="-geometry 1200x1024 -nolisten tcp -nohttpd"

Step 7: enable automatic startup of vncserver

Vncserver should be started at the multiuser runlevel, ie runlevel 5.

To enable this perform the following command as root user:
    chkconfig --level 5 vncserver on

To verify the setting in the runleve the following command can be used:
         chkconfig --list | grep vnc

Hope this helps
Yours