Linux Filesystem management

–>File system Ids

ext2/ext3  –>83

linux swap  ->82

RAID       –>fd

LVM        –>83

above id no. are based on hex system

#fdisk -l

-> Disk partitioning tools

.fdisk -> post-installaton disk partitioning tool (other disk partition tools

sfdiks – can be used in scripts

parted- advanced disk partitioning tool (partition can be resize though this tool)

.fdisk -l (lists partition table of all the disks)

to create new partition

#fdisk /dev/hda1

m –>lists all the fdisk commands & theier jobs

p –>prints partition table

n –>to create new partition

t –>to specify file system id

d –>to delete a partition

q –>to quit without save

w –>to write  (ie. save) the changes into disk & quit

press n to create new partition

#partprobe – updates new partition table

#partprobe – updates new partition table

#partprobe – updates new partition table

–Creating file system (ie. formatiing)

a. mkfs -t <fs_type> <partition_name>

ie.

#mkfs ext3 /dev/hdax (x is last created partition nukber)

or

b.  #mke2fs.<fs_type> <partition_name>

ie. #mkfs.ext3 /dev/hdax

c.

mke2fs [options] [partition_name]

options= -j – to create ext3 with journaling

-b <block_size in byte>

-l <label name>

-c to check for badblocks before creating file system

examples:

#cd /

#mkdir directory (ie. personnel)

mke2fs -j -b 2048 -l /personnel /dev/hdax

#e2label /dev/hdax (to chck label)

#e2lable /dev/hdax new /newlabel