Linux Basics: Directory, Partition and Mounting File system

Directory Description
/
The root directory, the top-level directory in the FHS. All other directories are subdirectories of root, which is always mounted on some partition.
/bin
Essential command line utilities. Should not be mounted separately; otherwise, it could be difficult to get to these utilities when using a rescue disk.
/boot
Includes Linux startup files, including the Linux kernel. The default, 100MB, is usually sufficient for a typical modular kernel and additional kernels that you might install during the RHCE or RHCT exams.
/dev
Hardware and software device drivers for everything from floppy drives to terminals. Do not mount this directory on a separate partition.
/etc
Most basic configuration files.
/home
Home directories for almost every user.
/lib
Program libraries for the kernel and various command line utilities. Do not mount this directory on a separate partition.
/mnt
The mount point for removable media, including floppy drives, CD-ROMs, and Zip disks.
/opt
Applications such as the WordPerfect or OpenOffice.org Office suites.
/proc
Currently running kernel-related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels.
/root
The home directory of the root user.
/sbin
System administration commands. Don't mount this directory separately.
/tmp
Temporary files. By default, Red Hat Enterprise Linux deletes all files in this directory periodically.
/usr
Small programs accessible to all users. Includes many system

change directory

$cd /test

make directroy

$mkdir /test

view files

$ls -l

create/edit file

$ vim /test/xyz.txt

search file

$ locate xyz.txt
or
$ find / -name xyz

Creating Partition

$ fdsk /dev/sda

To see Partition

$ fdsk -l

and

$ df -h

Creating an ext2, or ext3, or ext4 filesystem

Create an ext4 file system:
$ mkfs.ext4 /dev/sda1

(or)

$ mke2fs -t ext4 /dev/sda1

Converting ext3 to ext4 
If you are upgrading /dev/sda2 that is mounted as /home, from ext3 to ext4, do the following:

$ umount /dev/sda2
$ tune2fs -O extents,uninit_bg,dir_index /dev/sda2
$ e2fsck -pf /dev/sda2
$ mount /dev/sda2 /home




To initialize partition without rebooting:

$ Partprobe /dev/sda

Hard Mounting:

create a mount point:
$ mkdir /test
$ mount -t ext3 /dev/sda2 /test


to mount this partition permanently open /etc/fstab
make a entry for this partition in end of file
/dev/sda2 /test ext3 defaults 0 0

Comments

Popular Posts