what steps to take to design a linux system and filesystem

create filesystem on linux

A filesystem is an arrangement of data and metadata on the storage device. If you want to admission any files in Unix like operating organization, the filesystem has to exist mounted where the file resides.

The well-know Linux filesystems are Ext, Ext2, Ext3, Ex4, BtrFS, ReiserFS, ZFS, XFS, JFS, and Swap.

Allow's create a partition on Linux, create a filesystem, and learn how to mountain that filesystem.

Step 1: Create a Partition

Before creating a file arrangement, make sure you have enough unallocated disk space ( or free cylinders).

You lot tin check disk space using fdisk -l or parted print costless command:

          $ sudo fdisk -l Deejay /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/rails, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Showtime End Blocks Id System /dev/sda1 * ane 1020 8193118+ 83 Linux /dev/sda2 1021 1147 1020127+ 82 Linux swap / Solaris        

Here yous can see 1305 cylinders are present on '/dev/sda' disk and used up to 1147 cylinders. Therefore, we can create a new partition.

You may use fdisk or parted command to create a new sectionalisation.

In the following example, I am using fdisk command to create a sectionalization on the hard drive named '/dev/sda' (kickoff hard disk).

          $ sudo fdisk /dev/sda Press n Printing p Press "Enter" for default starting cylinder" Enter 100MB+ Now Change the partitioning type to 83 and finally reboot the system.        

Footstep 2: Fix Disk Characterization on the partition

You can use e2label command to gear up or modify deejay labels. The e2label control must be run as root user.

The following command ready disk datafiles on the disk sectionalisation named '/dev/sda3'.

          $ sudo e2label /dev/sda3 datafiles        

To view the disk label, run the following command:

          $ sudo e2label datafiles        

Step 3: Create a filesystem

In Linux, y'all tin create filesystem using mkfs, mkfs.ext2, mkfs.ext3, mkfs.ext4, mke4fs or mkfs.xfs commands. On RHEL and CentOS organization y'all may install an additional bundle called e4fsprogs which can manage ext4 filesystem.

The following commands create an ext4 filesystem on the '/dev/sda3' disk sectionalization:

          $ sudo mkfs.ext4 /dev/sda3 mke2fs one.39 (29-May-2006) Filesystem label= Os type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 26208 inodes, 104420 blocks 5221 blocks (five.00%) reserved for the super user First data cake=1 Maximum filesystem blocks=67371008 xiii block groups 8192 blocks per grouping, 8192 fragments per group 2016 inodes per grouping Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: washed Creating journal (4096 blocks): done Writing superblocks and filesystem bookkeeping information: done        

Stride 3: Mounting a Filesystem

The most commonly used method for mounting the filesystem is either manually using mount command or past adding entries in /etc/fstab file, so that filesystem gets mounted during kicking fourth dimension.

Example:

          $ sudo mount /dev/sda3 /data        

In the above example, we have mounted '/dev/sda3' partition to '/data' directory.

You tin verify by executing the following command:

          $ sudo mount | grep -i sda3 /dev/sda3 on /data blazon ext4 (rw)        

Also, you can unmount /dev/sda3 using umount command.

          $ sudo umount /data        

Whenever linux system reboots the '/data' filesystem gets unusable. If you desire to use the filesystem over again, y'all take to mount it manually.

To avert this repeated mounting subsequently Linux kick, we accept to add entries in /etc/fstab file and so information technology will be persistent over reboots.

Here we will cursory about /etc/fstab configuration file. You should add an entry in fstab file as follows:

          Label=datafiles /data              ext4    defaults        1 2 or /dev/sda3 /data              ext4    defaults        one 2        

An case fstab file:

          $ true cat /etc/fstab #device name mountpoint Type of fs options dump fsck Characterization=/ / ext4 defaults 1 ane Label=SWAP-sda2 swap swap defaults 0 0 /dev/sda3 /data ext4 defaults 0 0        

where,

device name: Proper name of the device/sectionalisation or source path (What to mount) /dev/sda3

mount point: Where data is fastened to the filesystem (Where to mount) /information

type of the FS: Type of the filesystem are ext2, ext3, ext4, nfs, proc, etc.

options: In this option, you tin apply a security policy to the detail file organization. For example, when yous mount, you tin either set up no execution of the binaries or you can ready read-merely filesystem. By default, the filesystem is having rw, suid, rw, exec, auto, nouser and async.

dump: This is used for filesystem backup. If value zero is ready, backup is ignored. If 1 is set up, the filesystem is backed upwardly.

fsck: This selection is to decide on which order the filesystems should be checked.

Display Mount Information

You can run df -h or lsblk control to become mounted device information such equally mount point, filesystem size, etc.

          $ df -h        

The findmnt is a very handy tool to list all mounted filesystem, run the control as below:

          $ findmnt        

Determination

In this tutorial, we larn how to create a filesystem in Linux past first creating a partition, formatting, and finally mounted. If you accept any questions or feedback, feel gratis to leave a comment.

barneslonts1937.blogspot.com

Source: https://linoxide.com/how-create-format-mount-filesystems-linux/

0 Response to "what steps to take to design a linux system and filesystem"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel