{"id":14038,"date":"2017-12-26T13:51:00","date_gmt":"2017-12-26T18:51:00","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/?p=14038"},"modified":"2017-12-26T13:51:00","modified_gmt":"2017-12-26T18:51:00","slug":"file-systems-linux-commands-redhat-centos-fedora","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=14038","title":{"rendered":"On File Systems and Linux Commands (Redhat\/CentOs\/Fedora)"},"content":{"rendered":"<p>On File Systems and Linux Commands (Redhat\/CentOs\/Fedora)<\/p>\n<p>echo &#8220;Dec 26th, 2017, Sayed Ahmed, Justetc Technologies&#8221;<\/p>\n<p>On file Systems &#8211; Target Audience: Technical People. Software Developers and System\/Network Administrators or DevOps\u00a0 (or wanna be)<\/p>\n<p>\/ and \/boot are the default Linux file systems<\/p>\n<p>you can also configure \/home, \/opt, \/var, \/tmp, \/usr as separate file systems or can make these as part of the \/ file systems.<\/p>\n<p>\/ and \/boot are mandatory<\/p>\n<p>The advantages of having separate file systems (and\/or partitions) for different purpose (\/var, \/usr) are: you can independently manage them, extend them or reduce them as required. Can implement restriction on users who can access which file system. do repair and maintenance activities separatel<\/p>\n<p>Types of file systems: ext2, ext3, ext4, xfs (default for Redhat 7), btrfs, vfat, iso9660, BIOS Boot, EFI System Partitions, NFS, AutoFS, CIFS (Common Internet File Systems)<\/p>\n<p>AutoFS: NFS based auto mount. You can use this for LDAP Client configuration. Check our LDAP Notes.<\/p>\n<p>xfs_repair : repair xfs file system devices<\/p>\n<p>813 File System Administration Commands<br \/>\n814 dumpe2fs<br \/>\n815 dumpe2fs \/dev\/sdb<br \/>\n816 lsblk<br \/>\n817 dumpe2fs \/dev\/sdb<br \/>\n818 dumpe2fs \/dev\/sdc1<br \/>\n819 dumpe2fs \/dev\/sda<\/p>\n<p>820 e2fsck \/dev\/sdb<br \/>\n821 e2fsck \/dev\/sda<\/p>\n<p>823 lsblk<br \/>\n824 mkfs.ext2 \/dev\/sdb<br \/>\n825 mkfs.ext2 \/dev\/sdc1<\/p>\n<p>826 e2fsck \/dev\/sdc1<br \/>\n827 e2fsck is for ext2 file system. ext2 will be removed soon. ext2 is deprecated on RHEL 7.<br \/>\n828 fsck.ext2 \/dev\/sdc1<br \/>\n829 fsck.xfs \/dev\/sda<\/p>\n<p>&nbsp;<\/p>\n<p>830 xfs_repair \/dev\/sda<br \/>\n831 dumpe2fs, e2fsck, e2label, mke2fs, resize2fs, tune2fs, mkfs.xfs, xfs_admin, xfs_growfs, xfs_info, xfs_repair, mkfs.vfat, blkid, df, du, findmnt, fuser, mount, umout &#8211; some file system related linux commands<\/p>\n<p>&nbsp;<\/p>\n<p>835 man e2label<br \/>\n836 e2label &#8211; Change the label on an ext2\/ext3\/ext4 filesystem<br \/>\n837 SYNOPSIS<br \/>\n838 e2label device [ new-label ]<br \/>\n839 DESCRIPTION<br \/>\n840 e2label will display or change the filesystem label on the ext2, ext3, or ext4 filesystem located on device.<\/p>\n<p>841 man mke2fs<br \/>\nmke2fs is used to create an ext2, ext3, or ext4 filesystem, usually in a disk partition. device is the special file corresponding to the device (e.g \/dev\/hdXX). blocks-count is the number of blocks on the device. If omitted, mke2fs automagically figures the file system size. If called as mkfs.ext3 a journal is created as if the -j option was specified.<\/p>\n<p>man resize2fs<br \/>\nThe resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located<br \/>\non device. If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel supports on-line<br \/>\nresizing. (As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 and ext4.).<\/p>\n<p>849 man tune2fs<br \/>\ntune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2, ext3, or ext4 filesystems. The cur\u2010rent values of these options can be displayed by using the -l option to tune2fs(8) program, or by using the dumpe2fs(8) program.<\/p>\n<p>852 man mkfs.xfs<br \/>\nmkfs.xfs constructs an XFS filesystem by writing on a special file using the values found in the arguments of the command line. It is invoked automatically by mkfs(8) when it is given the -t xfs option.<\/p>\n<p>855 man xfs_admin<br \/>\nxfs_admin uses the xfs_db(8) command to modify various parameters of a filesystem.<br \/>\nDevices that are mounted cannot be modified. Administrators must unmount filesystems before xfs_admin or xfs_db(8) can convert parameters.<br \/>\nA number of parameters of a mounted filesystem can be examined and modified using the xfs_growfs(8) command.<\/p>\n<p>859 man xfs_growfs<br \/>\nxfs_growfs expands an existing XFS filesystem (see xfs(5)). The mount-point argument is the pathname of the directory where the filesystem is mounted. The filesystem must be mounted to be grown (see mount(8)). The existing contents of the filesystem are undisturbed, and the added space becomes available for additional file storage.<\/p>\n<p>863 man xfs_info<br \/>\nxfs_info is equivalent to invoking xfs_growfs with the -n option (see discussion below).<\/p>\n<p>865 man xfs_repair<br \/>\nxfs_repair repairs corrupt or damaged XFS filesystems (see xfs(5)). The filesystem is specified using the device argument which should be the device name of the disk partition or volume containing the filesystem. If given the name of a block device, xfs_repair will attempt to find the raw device associated with the specified block device and will use the raw device instead. Regardless, the filesystem to be repaired must be unmounted, otherwise, the resulting filesystem may be inconsistent or corrupt.<\/p>\n<p>870 man mkfs.vfat<br \/>\nmkfs.fat is used to create an MS-DOS filesystem under Linux on a device (usually a disk partition). device is the special file correspond\u2010ing to the device (e.g \/dev\/hdXX). block-count is the number of blocks on the device. If omitted, mkfs.fat automatically determines the filesystem size.<\/p>\n<p>874 man blkid<br \/>\nThe blkid program is the command-line interface to working with the libblkid(3) library. It can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).<\/p>\n<p>878 man df<br \/>\ndf displays the amount of disk space available on the file system containing each file<br \/>\nname argument. If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.<\/p>\n<p>882 df<br \/>\n883 du<\/p>\n<p>884 man du<br \/>\ndu &#8211; Summarize disk usage of each FILE, recursively for directories.<\/p>\n<p>886 man findmnt<br \/>\nfindmnt will list all mounted filesytems or search for a filesystem. The findmnt command is able to search in \/etc\/fstab, \/etc\/mtab or \/proc\/self\/mountinfo. If device or mountpoint is not given, all filesystems are shown.<\/p>\n<p>889 findmnt<\/p>\n<p>890 man fuser<br \/>\nfuser displays the PIDs of processes using the specified files or file systems. In the default display mode, each file name is followed by a letter denoting the type of access:<br \/>\nc current directory.<br \/>\ne executable being run.<br \/>\nf open file. f is omitted in default display mode.<br \/>\nF open file for writing. F is omitted in default display mode.<br \/>\nr root directory.<br \/>\nm mmap&#8217;ed file or shared library.<\/p>\n<p>899 man mount<br \/>\nmount command &#8211; All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at \/. These files can be spread out over several devices. The mount command serves to attach the filesystem found on some device to the big file tree. Conversely, the umount(8) command will detach it again.<\/p>\n<p>&nbsp;<\/p>\n<p>903 man umount<br \/>\numount &#8211; The umount command detaches the file system(s) mentioned from the file hierarchy.<br \/>\nYou can customize mount operation by giving some parameters and options such as async: allow async I\/O operation, acl: to support ACL (facl: getfacl, setfacl), users: allow all users to mount exec:noexec: permit\/deny execution of binary files, ro:read only suid\/nosuid: allow\/disallow setuid operation user\/nouser: allow\/disallow a normal user to mount the file system remount: remount an already existing filesystem,<\/p>\n<p>_netdev: network connectivity is a must before mounting, owner: allow the file system owner to mount dev\/nodev: allow\/disallow device files on the file system, defaults: accept all defaults (async, auto, dev, exec, nouser, rw, suid), auto: support auto mounting when -a option is used for mount command<\/p>\n<p>note: mount -a will mount all filesystems mentioned in \/etc\/fstab<br \/>\numount -a : everything mentioned in fstab will be unmounted. provided auto was there for the mount operation. auto is default parameter for mount command<\/p>\n<p>&nbsp;<\/p>\n<p>blkid : gives you UUID for partitions\/file systems. you can use UUID in \/etc\/fstab &#8211; usually is a good practice. because if you use \/dev\/sda \/dev\/sdb in the \/etc\/fstab &#8211; that might not work always because that can change depending on what storage device to add or remove to the system.<br \/>\n909 blkid<br \/>\n910 xfs_admin -u<br \/>\n911 xfs_admin -u \/dev\/sda<br \/>\n912 xfs_admin -u \/dev\/sda1<br \/>\n913 xfs_admin -u \/dev\/sdc1<br \/>\n914 xfs_admin -u device\/partition : will also give UUID for that partition<\/p>\n<p>&nbsp;<\/p>\n<p>915 blkid \/dev\/sdb<br \/>\n916 blkid \/dev\/sdc1<br \/>\n917 blkid<br \/>\n918 you can also create a label for a partition\/file-system and use that in the \/etc\/fstab file<br \/>\n919 xfs_admin -l \/dev\/sdc1<br \/>\n920 xfs_admin -l \/dev\/sda<br \/>\n921 lsblk<\/p>\n<p>926 lsblk<br \/>\n927 df -h<br \/>\nto create a label: xfs_admin -L testpartition \/dev\/sdc1<br \/>\n929 xfs_admin -L testpartition \/dev\/sdc1<br \/>\n930 then you can use testpartition in the \/etc\/fstab file<\/p>\n<p>xfs_admin : -l shows label, -L creates label<\/p>\n<p>932 cat \/etc\/fstab<br \/>\n933 the default format in the \/etc\/fstab file<br \/>\n934 \/dev\/mapper\/cl-root \/ xfs defaults 0 0<\/p>\n<p><strong>device\u00a0 \u00a0<\/strong>mount-point file-system defaults\/options-you-want(auto, rw, defaults, async) dump-or-not-for-dump-command scan-sequence-for-fsck<\/p>\n<p>UUID and Label cab be used for the device\/first parameter on \/etc\/fstab file<\/p>\n<p>941 vim \/etc\/fstab<br \/>\nexamples:<\/p>\n<p>\/dev\/mapper\/cl-root \/ xfs defaults 0 0<\/p>\n<p>UUID=45213437-3dcf-4ee7-b6b7-26c37e2a82d7 \/boot xfs defaults 0 0<\/p>\n<p>\/dev\/mapper\/cl-swap swap swap defaults 0 0<\/p>\n<p>\/dev\/sdb1 \/mnt ext2 defaults 0 0<\/p>\n<p>947 df -h: disk free : check usage<br \/>\n948 df -h<\/p>\n<p>partiton exercise<br \/>\n950 parted \/dev\/sdb mklabel msdos<br \/>\n951 parted \/dev\/sdb mkpart 1 101MB<br \/>\n952 parted \/dev\/sdb mkpart primary 1 101MB<br \/>\n953 parted \/dev\/sdb print<br \/>\n954 parted \/dev\/sdb mkpart primary 101 201MB<br \/>\n955 parted \/dev\/sdb print<\/p>\n<p>956 mke2fs -t ext3 \/dev\/sdb2<br \/>\n957 mkfs.xfs \/dev\/sdb1<\/p>\n<p>958 blkid<br \/>\n959 xfs_admin -L testlabel \/dev\/sdb1<\/p>\n<p>960 vim \/etc\/fstab<br \/>\n961 mkdir -p \/disks\/sdb1<\/p>\n<p>962 mount -a<br \/>\n963 vim \/etc\/fstab<br \/>\n964 mount -a<br \/>\n965 blkid<br \/>\n966 vim \/etc\/fstab<br \/>\n967 mount -a<br \/>\n968 umount -a<br \/>\n969 mount -a<br \/>\n970 cat \/etc\/fstab<\/p>\n<p>971 example of using label on \/etc\/fstab<br \/>\n972 LABEL=&#8221;testlabel&#8221; \/disks\/sdb1 xfs defaults 0 1<\/p>\n<p>973 xfs_repair \/dev\/sdb1<\/p>\n<p>974 umount \/dev\/sdb1<br \/>\n975 xfs_repair \/dev\/sdb1<br \/>\n976 xfs_repair : requires the file system to be unmounted<\/p>\n<p>&nbsp;<\/p>\n<p>you can use nfs-utils to mount\/unmount remote file systems<br \/>\n978 yum -y install nfs-utils<br \/>\n979 mkdir \/disks\/nfs-pc2<\/p>\n<p>the format in the \/etc\/fstab file can be<br \/>\n981 192.168.10.15:\/folder\/fs-to-share-remotely \/disks\/nfs-pc2 nfs _netdev 0 0<\/p>\n<p>check that I used: nfs as the file system<br \/>\nFor options: I used _netdev because this is network devie and network connectivity is a must for this mounting operation<\/p>\n<p>to mount cd-drive on redhat\/centos\/fedora<br \/>\n985 mount \/dev\/sr0 \/mnt<br \/>\ndf -h can show you the cdrom device. for me it was: \/dev\/sr0<\/p>\n<p>987 df -h<br \/>\nyou could use -t with mount command to give file system. However, for CD the default works fine<br \/>\nfor NFS to mount using commands<\/p>\n<p>mount -t nfs 192.168.1.15:\/folder-or-fs-to-share-remotely \/mount-point-on-our-system-like-\/disks\/nfs\/pc2-share<\/p>\n<p>you can also mount samba file system as well<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On File Systems and Linux Commands (Redhat\/CentOs\/Fedora) echo &#8220;Dec 26th, 2017, Sayed Ahmed, Justetc Technologies&#8221; On file Systems &#8211; Target Audience: Technical People. Software Developers and System\/Network Administrators or DevOps\u00a0 (or wanna be) \/ and \/boot are the default Linux file systems you can also configure \/home, \/opt, \/var, \/tmp, \/usr as separate file systems &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=14038\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1231],"tags":[],"class_list":["post-14038","post","type-post","status-publish","format-standard","hentry","category-----linux-and-unix","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":14029,"url":"http:\/\/bangla.sitestree.com\/?p=14029","url_meta":{"origin":14038,"position":0},"title":"TCP Wrappers in Linux\/CentOS\/Redhat\/Fedora","author":"Sayed","date":"December 24, 2017","format":false,"excerpt":"TCP Wrappers in Linux\/CentOS\/Redhat\/Fedora yum info tcp_wrappers yum install tcp_wrappers-devel.x86_64 506 reboot 507 ifdown ens33 508 ifup ens33 509 yum install tcp_wrappers-devel.x86_64 510 yum -y install tcp_wrappers-devel.x86_64 511 ls \/var\/ftp\/pub\/Packages\/ 512 ls \/etc\/yum.repos.d\/local.repo 513 vim \/etc\/yum.repos.d\/local.repo 514 systemctl status vsftpd 515 systemctl start vsftpd 516 systemctl enable vsftpd 517 yum\u2026","rel":"","context":"In &quot;\u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f\u09ac\u0982 \u0989\u09a8\u09bf\u0995\u09cd\u09b8 \u0964 Linux and Unix&quot;","block_context":{"text":"\u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f\u09ac\u0982 \u0989\u09a8\u09bf\u0995\u09cd\u09b8 \u0964 Linux and Unix","link":"http:\/\/bangla.sitestree.com\/?cat=1231"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20401,"url":"http:\/\/bangla.sitestree.com\/?p=20401","url_meta":{"origin":14038,"position":1},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7 @anaconda There are\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20403,"url":"http:\/\/bangla.sitestree.com\/?p=20403","url_meta":{"origin":14038,"position":2},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20405,"url":"http:\/\/bangla.sitestree.com\/?p=20405","url_meta":{"origin":14038,"position":3},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20409,"url":"http:\/\/bangla.sitestree.com\/?p=20409","url_meta":{"origin":14038,"position":4},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20411,"url":"http:\/\/bangla.sitestree.com\/?p=20411","url_meta":{"origin":14038,"position":5},"title":"Learn some Centos\/Redhat Linux: RHCE: MariaDB Administration on Redhat\/Fedora\/CentOS","author":"Author-Check- Article-or-Video","date":"February 20, 2021","format":false,"excerpt":"The author is: the_authornRHCE: MariaDB Administration on Redhat\/Fedora\/CentOS Check if mariaDB is installed or not 130 yum list installed | grep ^mariadb mariaDB originated from MySQL - after MySQL Got Bought by Oracle 133 yum list installed | grep ^mariadb I see - installed though not completely Output: mariadb-libs.x86_64 1:5.5.52-1.el7\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14038"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14038\/revisions"}],"predecessor-version":[{"id":14039,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/14038\/revisions\/14039"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14038"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}