Tech Support Notes

Creating / Modifying Filesystems

ext2

Ext2 stands for second extended file system Ext2 does not have journaling feature. Maximum individual file size can be from 16 GB to 2 TB. Overall ext2 file system size can be from 2 TB to 32 TB

Convert ext2 to ext3

umount /dev/sda2
tune2fs -j /dev/sda2
mount /dev/sda2 /home

ext3

Ext3 stands for the third extended file system. The main benefit of ext3 is that it allows journaling. Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling. Maximum individual file size can be from 16 GB to 2 TB. Overall ext3 file system size can be from 2 TB to 32 TB. You can convert a ext2 file system to ext3 file system directly (without backup/restore).

mkfs.ext3 /dev/sda1
mke2fs –j /dev/sda1

Convert ext3 to ext4

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

ext4

Ext4 stands for fourth extended file system. Maximum individual file size can be from 16 GB to 16 TB Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte). Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)

mkfs.ext4 /dev/sda1
mke2fs -t ext4 /dev/sda1

xfs

An XFS filesystem can reside on a regular disk partition or on a logical volume. An XFS filesystem has up to three parts: a data section, a log section, and a realtime section. On Centos/RHEL you need to add the xfsprogs utility

yum install xfsprogs

[voyager] (~) >>> mkfs.xfs -f /dev/xvdc1
meta-data=/dev/xvdc1             isize=256    agcount=4, agsize=6553514 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=26214055, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=12799, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[voyager] (~) >>> mount -t xfs /dev/xvdc1 /xfs

[voyager] (~) >>> df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/xvda2    ext3    25544012   2376700  21869752  10% /
tmpfs        tmpfs      957168         0    957168   0% /dev/shm
/dev/xvda1    ext3      253871    100612    140152  42% /boot
/dev/xvdc1     xfs   104805024     32928 104772096   1% /xf
On Ubuntu you would need to install the xfsprogs utility:
apt-get install xfsprogs

mkfs.xfs -f /dev/xvdc1

[solaris] (~) >>> df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/xvda2    ext3    25555836   1067860  23189800   5% /
none      devtmpfs     1003744       132   1003612   1% /dev
none         tmpfs     1058932         0   1058932   0% /dev/shm
none         tmpfs     1058932        44   1058888   1% /var/run
none         tmpfs     1058932         0   1058932   0% /var/lock
none         tmpfs     1058932         0   1058932   0% /lib/init/rw
/dev/xvda1    ext3      240972     19246    209285   9% /boot
/dev/xvdc1     xfs    26197220      4256  26192964   1% /xfs
xfs_check device
umount /xfs

[voyager] (~) >>> xfs_check /dev/xvdc1

xfs_repair device

reiserfs

ReiserFS is a general-purpose, journaled computer file system designed and implemented by a team at Namesys led by Hans Reiser.

By default Centos/RHEL does not include support for ReiserFS without adding the Epel repo

rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
yum install kmod-reiserfs reiserfs-utils

/sbin/mkfs.reiserfs /dev/xvdc1
mount -t reiserfs /dev/xvdc1 /reiserfstest

[voyager] (~) >>> df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/xvda2    ext3    25544012   2373176  21873276  10% /
tmpfs        tmpfs      957168         0    957168   0% /dev/shm
/dev/xvda1    ext3      253871    100612    140152  42% /boot
/dev/xvdc1   reiserfs   104852988     32840 104820148   1% /reiserfstest

For Ubuntu you need to install the reiserfsprogs utility

apt-get install reiserfsprogs

/sbin/mkfs.reiserfs /dev/xvdc1

[solaris] (~) >>> df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/xvda2    ext3    25555836   1062832  23194828   5% /
none      devtmpfs     1003744       132   1003612   1% /dev
none         tmpfs     1058932         0   1058932   0% /dev/shm
none         tmpfs     1058932        40   1058892   1% /var/run
none         tmpfs     1058932         0   1058932   0% /var/lock
none         tmpfs     1058932         0   1058932   0%     /lib/init/rw
/dev/xvda1    ext3      240972     19246    209285   9% /boot
/dev/xvdc1   reiserfs    26209180     32840  26176340   1% /reiserfstest

vfat

VFAT is an extension of the FAT file system and was introduced with Windows 95. VFAT maintains backward compatibility with FAT but relaxes the rules. For example, VFAT filenames can contain up to 255 characters, spaces, and multiple periods. Although VFAT preserves the case of filenames, it's not considered case sensitive

Rebuild Journal

Remove and rebuild journal

fsck -y -C /dev/sda$  
tune2fs -O ^has_journal /dev/sda$    
fsck -y -C /dev/sda$  
tune2fs -j /dev/sda$  
fsck -y -C /dev/sda$

mkfs

Used to build a Linux file system on a device, usually a hard disk partition Handy flags: -c = Check the device for bad blocks before building the file system
-t fstype - Specifies the type of file system to be built. If not specified, the default file system type (currently ext2) is used.

[voyager] (~) >>> mkfs -t ext3 /dev/xvdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214055 blocks
1310702 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first.  Use tune2fs -c or -i to override.
Optionally you can use mkfs.ext3 (etc) to make the filesystem based on your needs
[voyager] (~) >>> mkfs.ext3 /dev/xvdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214055 blocks
1310702 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

mkswap

Used to set up a Linux swap area on a device or in a file.

[voyager] (~) >>> mkswap /dev/xvdc1
Setting up swapspace version 1, size = 160612 KiB
no label, UUID=d567bb49-6ba2-4618-968c-4d5f0a9294e5

[voyager] (~) >>> swapon /dev/xvdc1

[voyager] (~) >>> swapon -s
Filename                                Type            Size    Used    Priority
/dev/xvdb1                              partition       2096440 0       -1
/dev/xvdc1                              partition       160608  0       -2