Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Thursday 31 October 2013

Filesystems in linux


Redhat Enterprise Linux supports the below type of filesystems.

1. Local or Disk based Filesystems such as ext2, ext3, ext4, xfs.
2. Memory based filesystems such as tmpfs, proc, ramfs.
2. Network based Filesystem such as nfs, cifs.
3. Shared Storage based Filesystem such asgfs1, gfs2.

Disk Based Filesystems:

Ext2 Filesystem :

The ext2 or second extended filesystem was used long back and now-a-days we don't create these type of filesystem because of size restrictions and slow performance.
A strange limitation of Ext2 is it supports only upto the date January 18, 2038.
Some limitations of ext2 are
Max File Size = 16GB-2TB
Max Filesystem Size = 2-32 TB

Ext3 Filesystem :

Ext3 filesystem has been the most commonly used filesystem. It is actually an journalled Ext2 filesystem.
Ext3 filesystems can be remounted as Ext2 filesystems without any conversion.
On high-end storage devices, Ext3 has some limitations in that it can only scale to a maximum of 16TB. On a 1TB S-ATA drive, the performance of the Ext3 filesystem repair utility (fsck), which
is used to verify and repair the filesystem after a crash, is extremely long. For many users that require high availability, the Ext3 filesystem typically supports close to 2-4TB of storage.

Ext4 Filesystem :

Ext4 is the fourth generation of the Ext filesystem family and is the default filesystem in Red Hat Enterprise Linux 6. Ext4 has been offered in test previews since Red Hat Enterprise Linux 5.4, giving customers confidence in its maturity. Some features of Ext4 are extent-based metadata, delayed allocation, large storage support, journal check-summing. Filesystem repair time (fsck) in Ext4 is much faster than in Ext2 and Ext3. Currently, Red Hat’s maximum supported size for Ext4 is 16TB in both Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6

XFS Filesystem:

XFS is a robust and mature 64-bit journaling filesystem that supports very large files and filesystems on a single host. Red Hat’s maximum supported XFS filesystem image is 100TB. XFS is one of the highest performing filesystems on large systems with enterprise workloads.

Some features of XFS are

• delayed allocation
• dynamically allocated inodes
• b-tree indexing for scalability of free space management
• ability to support a large number of concurrent operations
• extensive run-time metadata consistency checking
• sophisticated metadata read-ahead algorithms
• tightly integrated backup and restore utilities
• online defragmentation
• online filesystem growing
• comprehensive diagnostics capabilities
• scalable and fast repair utilities

And also the other OS based filesystems (given below) are also supported in Redhat linux such as

UFS: Used in Solaris and early BSD operating systems. Linux provides read and write support is experimental.

FAT: Windows based filesystem.

NTFS: Windows NT based filesystem. Unlike FAT, it is a b-tree file system, meaning it has a performance and reliability advantage over FAT.

Which filesystem should I use ?
For large server/storage device, you can go for XFS.
Generally Ext3/Ext4 should be fine for most of the filesystems.
If your existing workload has performed well with Ext3, staying with Ext3 on Red Hat Enterprise Linux 5 or migrating to Ext4 on Red Hat Enterprise Linux 6 should provide you and your applications with a very familiar environment. Two key advantages of Ext4 over Ext3 on the same storage include faster filesystem check and repair times and higher streaming read and write performance on high-speed devices.

In general Ext3 or Ext4 is better if an application uses a single read/write thread and small files, while XFS shines when an application uses multiple read/write threads and bigger files.


Configuration Files:
1. /etx/fstab - You need to edit this file to automate the file system mounts:

2. /etc/mtab - An entry will be added/removed to this file every time a filesystem gets mounted/unmounted.


Now let us look at the commands to manage the filesystems.


Q. How to list current mounts:
A.
# mount
# cat /etc/mtab

Q. How to create an Ext4 filesystem on a disk/partition/LV :
A.
# mkfs -t ext4 /dev/sdb
# mkfs -t ext4 /dev/sdb1
# mkfs -t ext4 /dev/vg00/lvol1

Here mention the file system type after the flag 't'.

Above command can be used to create any type of file system
Whereas below commands are restricted to specific types only.

EXT2 : mke2fs or mkfs.ext2
EXT3 : mkfs.ext3
Reiserfs: mkfs.reiserfs
vfat : mkfs.vfat
xfs : mkfs.xfs
MSDos : mkdosfs or mkfs.msdos
minix : mkfs.minix
xiafs : mkfs.xiafs
NTFS : mkntfs

Q. How to run file system check ( you need unmount a filesystem before proceeding with fsck command) :
A. fsck -t ext2 /dev/sdb1

Q. How to check all file systems except the mounted ones:
A.
# fsck -m -A

File system specific fsck commands:
EXT2 : fsck.ext2 or e2fsck
Reiserfs: reiserfsck
JFS : fsck.jfs
xfs : fsck.xfs
xiafs : fsck.xiafs
minix : fsck.minix

Q. How to mount a ext2 file system:
A.
#mount -t ext2 /dev/sdb1 /mnt/usb

Q. How to mount all filesystems:
A.
# mount -a

Q. To mount all ext2 file systems:
A.
# mount -a -t ext2

Q. Unmount a file system:
A.
# umount /mnt/usb

Q. To unmount all the mounted filesystems (except / and currently used ones):
A. 
# umount -a

Q. To list open files on a mounted file system:
A.
# /usr/bin/lsof +D /mnt/usb

Q. To adjust tunable filesystem paramets on ext2/ext3 filesystems:
A.
# tune2fs /dev/sdb1

Q. To list the contents of the filesystem superblock:
A.  You can use any of the below commands.

# tune2fs -l /dev/sdb1
# dumpe2fs -b /dev/sdb1

Q. To extend /data filesystem (without unmounting) :
A.

# ext2online -v /data

Q. How to display the filesystem size, usage, free space, mount points, etc..
A:
# df -h 

Q. How to shrink a filesystem
A.  You can not do an online filesystem shrink. 
You need to unmount a filesystem before reducing its size.
Perform the following steps (1 to 7) to reduce a filesystem size.

1. Unmount the filesystem
# umount /mntpoint

2. Do filesystem check
# e2fsck -f /dev/mapper/vgname-lvname

3. Reduce the filesystem to 25GB
# resize2fs /dev/mapper/vgname-lvname 25G

4. Reduce the logical volume 
# lvresize -L 25G /dev/mapper/vgname-lvname

5. Verify the LV Size
# lvdisplay /dev/vgname/lvname

6. Mount the filesystem
# mntpoint

7. Verify the filesystem size
# df -h /mntpoint

No comments:

Post a Comment