Sunday, December 16, 2012

LVM partitions mount in rescue mode RedHat/Cent OS/Fedora

Boot your rescue media.
Scan for volume groups:
# lvm vgscan -v

Activate all volume groups:
# lvm vgchange -a y

List logical volumes:
# lvm lvs –all

With this information, and the volumes activated, you should be able to mount the volumes:
# mount /dev/mapper/VolGroup00-LogVolRoot  /mnt/mountpoint

Monday, October 29, 2012

RAMDISK Linux


Software RAM disks use the normal RAM in main memory as if it were a partition on a hard drive rather than actually accessing the data bus normally used for secondary storage such as hard disk. How do I create and store a web cache on a RAM disk to improve the speed of loading pages under Linux operating systems?


mkdir /tmp/ramdisk;
# chmod 777 /tmp/ramdisk
mount -t tmpfs -o size=256M tmpfs /tmp/ramdisk/
where 256M is amount of RAM you wish to allocate for ramdisk. It’s clear that this value should be less than amount of free memory (use “free -m“).
By default 16 ramdisks are already created in RHEL/CentOS/Fedora

Monday, October 15, 2012

sshfs CentOS /RHEL/Fedora

This is a filesystem client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there's nothing to do.  On the client side mounting the filesystem is as easy as logging into the server with ssh.



  1. Login to your linux server as root
  2. Install fuse-sshfs
    #yum install fuse-sshfs -y
  3. Create a mount directory
    #mkdir /mnt/mountdir
  4. Mount the remote directory
    #sshfs user@192.168.0.1:/mountatremote /mnt/mountdir/
    SSHFS will then ask you to authenticate with the password for the user account you supplied
  5. To unmount the drive:
    #umount /sshfs/mount/

Monday, October 8, 2012

lock user to his home directories using chroot


Create chroot directory.

# mkdir /chroot

Create user's home directory, which will be actually '/' directory after user login.

# mkdir -p /chroot/home/pinky

Copy all the files that the user needs including basic commands like 'ls', libraries and /dev files.

# mkdir /chroot/home/pinky/bin
# cp -a /bin/bash /chroot/home/pinky/bin/.
# cp -a /bin/ls /chroot/home/pinky/bin/.
# cp -a /lib64 /chroot/home/pinky/.

Edit /etc/ssh/sshd_config file

ChrootDirectory /chroot/%h

Restart sshd

# service sshd restart
# chkconfig sshd on

Now sshd works with chrooted environment. So when Pinky logins, the directory /chroot/home/pinky will be '/'.