Managing Partitioned and Creating Filesystem
Managing Partitioned and Creating Filesystem
Creating Partitioned
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Step 5:Press [w] key to write the changes to the partition table and
exit
To Save the Partitioned Table ,Type w
WARNING: Re-reading the partition table failed with error 16: Device or
resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]#Command (m for help): w
The partition table has been altered!
WARNING: Re-reading the partition table failed with error 16: Device or
resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]#
New partitioned created has not been reflected in partition table ,for
changes to reflected its need to be rebooted.
But in production ,we cannot reboot server machine .
11 0 1048575 sr0
8 0 78643200 sda
8 1 1049600 sda1
8 2 10884096 sda2
8 3 2097152 sda3
8 4 1 sda4
8 5 5892096 sda5
[root@localhost ~]#
11 0 1048575 sr0
8 0 78643200 sda
8 1 1049600 sda1
8 2 10884096 sda2
8 3 2097152 sda3
8 4 1 sda4
8 5 5892096 sda5
8 6 4194304 sda6
[root@localhost ~]#
Now New Partitioned has been created but its just a Raw partitioned .
[root@localhost ~]# fdisk -l
[root@localhost ~]#
To see filesystem type and Partitioned Information ,you can also use
command blkid
Delete a partition
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Step 3 :In command Line Type Press [d] key and select partition number
to delete a partition .
Step 3 :In command Line Type Press [w] key to write the changes to the
partition Table and exit
WARNING: Re-reading the partition table failed with error 16: Device
or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]#
Even after deleting from Command Line ,in Partition Table still
partitioned is not deleted ,can be verify from file /proc/partitions
[root@localhost ~]# cat /proc/partitions
major minor #blocks name
11 0 1048575 sr0
8 0 78643200 sda
8 1 1049600 sda1
8 2 10884096 sda2
8 3 2097152 sda3
8 4 1 sda4
8 5 5892096 sda5
8 6 4194304 sda6
[root@localhost ~]#
Step 5 :To Update the Partitioned table without Machine restart ,use
partprobe command
Step 6 :Now we can verify same in Partition Table ,by looking into
file /proc/partitions , we can se sda6 has been deleted.
11 0 1048575 sr0
8 0 78643200 sda
8 1 1049600 sda1
8 2 10884096 sda2
8 3 2097152 sda3
8 4 1 sda4
8 5 5892096 sda5
[root@localhost ~]#
Making Filesystems
ls /sbin/mkfs*
mkfs options
-t Specifies the type of file system to built. The default is
ext2
-c Check the device for bad blocks before building a file
system
- v display Verbose output
[root@server ~]#
[root@server ~]#
Filesystem labels
E2label will display or change the file system labels, which provide
an alternative way to refer to devices
Syntax :e2label device labelname
Options
-c :Read from cache file instead of reading from the default
cache
-g : perform a garbage collection pass on the blkid cache to
remove devices which no longer exist
-h Display a usage message and exit
Tune2fs :
Tune2fs allows the system administrator to adjust file
system parameters
View File system information
Mount count :1
means After 1 mount it will check partitioned /dev/sda6
To verify the Inode & Block count by passing '-i' argument to tune2fs
command on a specific partition
Command:tune2fs -l /dev/sda6 |grep -i count
[root@server ~]# tune2fs -l /dev/sda17 |grep -i count
Inode count: 65536
Block count: 262144
Reserved block count: 13107
Mount count: 0
Maximum mount count: -1
To set after 200 mount and time period of 2 month ,It will check or
scan filesystem.
Dump2fs Command
Dump2fs prints the super block and blocks group information on the
file system and present on device
Command :dump2fs -h /dev/sda6
The above command dumps all file system information
[root@localhost ~]#
Mount
All files accessible in Linux system are arranged like a tree, the
file hierarchy rooted at "/".These files can be spread out over
several devices .The mount command serves to attach the file system
found on some device to one big file tree
Mount Point -
A mount point is a directory to access the data, which is stored in
our disks.
Fstab
/etc/fstab -static information about the file systems
the fstab file contains descriptive information about the various file
systems. Each file system and its mounting information is described in
a seperate line.Fields on each line are delimited by tabs
Command:cat /etc/fstab
[root@server ~]# cat /etc/fstab
#
# /etc/fstab
/dev/sda17 /agoutam ext4 defaults 0 0
[root@server ~]#
Fstab fields :
Unmounting Filesystems :
Command :umount /dev/sda17