Create, mount, unmount, and use vfat, ext4, and xfs file systems

For this purpose, we will work with a new disk, partitioned as follows:

Disk /dev/vdb: 2254 MB, 2254858240 bytes, 4404020 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3faed0a2
Device Boot Start End Blocks Id System
/dev/vdb1 2048 514047 256000 83 Linux
/dev/vdb2 514048 1026047 256000 83 Linux
/dev/vdb3 1026048 1538047 256000 83 Linux
/dev/vdb4 1538048 4404019 1432986 5 Extended
/dev/vdb5 1540096 2052095 256000 83 Linux

1. Format these partitions :

# mkfs.ext3 /dev/vdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
64000 inodes, 256000 blocks
12800 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
32 block groups
8192 blocks per group, 8192 fragments per group
2000 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

[root@cliente1 ~]# mkfs.ext4 /dev/vdb2
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
64000 inodes, 256000 blocks
12800 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33816576
32 block groups
8192 blocks per group, 8192 fragments per group
2000 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

[root@cliente1 ~]# mkfs.xfs /dev/vdb3
meta-data=/dev/vdb3 isize=512 agcount=4, agsize=16000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=64000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

[root@cliente1 ~]# mkfs.vfat /dev/vdb5
mkfs.fat 3.0.20 (12 Jun 2013)

2. Create the mount points:

# mkdir /mnt/{ext3,ext4,xfs,fat}
[root@cliente1 ~]# ls -ls /mnt/
total 0
0 drwxr-xr-x. 2 root root 6 Jun 14 18:52 ext3
0 drwxr-xr-x. 2 root root 6 Jun 14 18:52 ext4
0 drwxr-xr-x. 2 root root 6 Jun 14 18:52 fat
0 drwxr-xr-x. 2 root root 6 Jun 14 18:52 xfs

3. Mount temporally or permanent:

Temporal mount:

# mount /dev/vdb1 /media/
# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/myvg1-root xfs 5.3G 3.0G 2.4G 57% /
devtmpfs devtmpfs 905M 0 905M 0% /dev
tmpfs tmpfs 920M 188K 920M 1% /dev/shm
tmpfs tmpfs 920M 8.9M 911M 1% /run
tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 xfs 1014M 173M 842M 17% /boot
tmpfs tmpfs 184M 4.0K 184M 1% /run/user/42
tmpfs tmpfs 184M 28K 184M 1% /run/user/1000
tmpfs tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb1 ext3 239M 2.1M 224M 1% /media

umount command to dismount:
# umount /media/

Permanent mount:

# echo "/dev/vdb1 /mnt/ext3 ext3 defaults 0 0" >> /etc/fstab 
# mount -a
# echo "/dev/vdb2 /mnt/ext4 ext4 defaults 0 0" >> /etc/fstab
# mount -a
# echo "/dev/vdb3 /mnt/xfs xfs defaults 0 0" >> /etc/fstab
# mount -a
# echo "/dev/vdb5 /mnt/fat vfat defaults 0 0" >> /etc/fstab
# mount -a

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *