Total Pageviews

Tuesday, February 10, 2015

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.
Essential command line utilities. Should not be mounted separately; otherwise, it could be difficult to get to these utilities when using a rescue disk.
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.
Hardware and software device drivers for everything from floppy drives to terminals. Do not mount this directory on a separate partition.
Most basic configuration files.
Home directories for almost every user.
Program libraries for the kernel and various command line utilities. Do not mount this directory on a separate partition.
The mount point for removable media, including floppy drives, CD-ROMs, and Zip disks.
Applications such as the WordPerfect or Office suites.
Currently running kernel-related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels.
The home directory of the root user.
System administration commands. Don't mount this directory separately.
Temporary files. By default, Red Hat Enterprise Linux deletes all files in this directory periodically.
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
$ find / -name xyz

Creating Partition

$ fdsk /dev/sda

To see Partition

$ fdsk -l


$ df -h

Creating an ext2, or ext3, or ext4 filesystem

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


$ 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

No comments: