Tuesday, November 6, 2007

Configuring Disk Quota

To implement file quota we need to edit /etc/fstab file and add the usrquota and grpquota option to the partition for which you want to enable quotas

#vi /etc/fstab

/dev/VolGroup00/LogVol00 /ext3 defaults,usrquota,grpquota 11

save the file

Remount the filesystem

#mount -o remount

or if we have entered more than one filesystem in the fstab file then to remount all the filesystem

#mount -a remount

Run quotacheck command to check for an errors on the filesystem with quota check

#quotacheck -augmv

Syntax info are as follows:

a= perform quotacheck on all filesystems
m= the filesystem should not be mounted as read-only mode
u & g= tells to check for users and groups

Turn on the quota

#quotaon -augmv

Apply the quota for a particular user

#edquota -u sushanth

Apply quota for particular group

#edquota -r susgrp

Monday, November 5, 2007

Disk Space Management Using LVM

Before starting this task it is necessary to install the LVM package

Linux Kernel 2.4.x has the LVM inbuilt.

In this blog we will focus on how to create an LVM layout and then mount it under the home directory

My root partition is sda1 and sda2 is my swap

To start partitioning run fdisk on /dev/sda

#fdisk /dev/sda
Enter p to create a new primary partition , accept all the default values for the start and end cylinders.

The next step is to change the partition into LVM. This means that we need to change the disk system ID into 8e as a partition type.

The above mentioned task can be done using fdisk command

Now we will create a volume group.

Volume group is nothing but two or more physical volumes together form a volume group.To bring our disk under the volume group we will have to configure our physical volumes.

#pvcreate /dev/sda (this command will initialise the physical volume)

We will now create a volume group which uses this physical volume

# vgcreate home2 /dev/sda (home2 is the volume group)

In this manner we can have multiple physical volume under volume group home2

Now we have created the volume group, now we will create logical volumes. We can have many logical volumes under one volume group. Or we can use one complete logical group has one Logical volume.

#lvcreate -n downloads --size 1G home2

The above mentioned command will create a logical volume as download with 1GB space under volume group home2

-n is used to name the logical volume.

Before we can use the Logical Volume, we need to format it and then mount it.

We will create a directory under /mnt as mystuff.

Now we will format the logical volume (/dev/home2/download)

#mkfs ext3 /dev/home2/download

Once the formatting is over we will mount the logical volume on to the /mnt/mystuff

#mount /dev/home2/download /mnt/mystuff

To make a permanent entry

#vi /etc/fstab

/dev/home2/download /mnt/mystuff ext3 defaults 12

save the file

Mount NTFS partition on a Linux Machine from Command Prompt

Check the Kernel Version

#uname -r

Install the following rpm

#rpm -ivh kernel-ntfs.rpm

The rpm is available at www.linux-ntfs.org

#modprobe ntfs

Mount the NTFS partition

#mount -t ntfs /dev/hdb /mnt/ntfs

(create a directory ntfs under mnt directory)

Make the mount permanent by making an entry in the /etc/fstab

#vi /etc/fstab

/dev/hdb /mnt/ntfs ntfs defaults 00

save the file