IBM AIX: How to create a file system

On IBM AIX, you can create a file system using the crfs command. Below are the steps to create a simple Journaled File System (JFS) on AIX:

  1. Determine Disk and Logical Volume: Identify the physical disk and logical volume that you want to use for the file system. You can use the lspv and lsvg commands to list physical volumes and volume groups, respectively.lspv lsvg
  2. Create a Logical Volume: Use the mklv command to create a logical volume. Replace <volume_group> with the actual volume group name, <logical_volume> with the logical volume name, and <size> with the desired size.mklv -y <logical_volume> -t jfs2 <volume_group> <size>
  3. Create a File System: Use the crfs command to create a file system on the logical volume you just created. Replace <mount_point> with the desired mount point for the file system.crfs -v jfs2 -d <logical_volume> -m <mount_point> -A yes -p rw
    • -v jfs2: Specifies the type of file system as Journaled File System 2 (JFS2).
    • -d <logical_volume>: Specifies the logical volume.
    • -m <mount_point>: Specifies the mount point for the file system.
    • -A yes: Enables automatic mount during system startup.
    • -p rw: Specifies the mount options as read-write.
  4. Mount the File System: Use the mount command to mount the newly created file system.mount <mount_point>
  5. Verify the File System: Use the df command to verify that the file system is mounted.df -g

This is a basic example of creating a JFS2 file system on AIX. Adjust the commands and options based on your specific requirements, such as choosing a different file system type or specifying additional mount options.

Always refer to the AIX documentation or consult with your system administrator for the most accurate and up-to-date information based on your AIX version.

Linux: To create an ext4 file system on Linux using LVM (Logical Volume Manager), follow these steps:

To create an ext4 file system on Linux using LVM (Logical Volume Manager), follow these steps:

  1. Install LVM Tools (if not already installed): Ensure that the LVM tools are installed on your system. You can install them using your package manager. On Debian/Ubuntu, you can use apt, and on Red Hat/CentOS, you can use yum:
    • For Debian/Ubuntu
      • sudo apt-get install lvm2
    • For Red Hat/CentOS
      • sudo yum install lvm2
  2. Create Physical Volumes (PVs): Start by creating one or more physical volumes on your available storage devices, such as hard drives or partitions. Replace /dev/sdX with the appropriate device names:bash
    • sudo pvcreate /dev/sdX
  3. Create a Volume Group (VG): After creating one or more physical volumes, you can create a volume group that combines these physical volumes into a single pool of storage. Replace myvg with your desired volume group name:bash
    • sudo vgcreate myvg /dev/sdX1 /dev/sdX2 # Use the appropriate device names
  4. Create Logical Volumes (LVs): Now, create one or more logical volumes within the volume group. Specify the size and name for each logical volume. Replace /dev/myvg/mylv with your desired logical volume name and size:bash
    • sudo lvcreate -n mylv -L 10G myvg # Replace 10G with your desired size
  5. Create the ext4 File System: You can create the ext4 file system on the logical volume you just created using the mkfs.ext4 command:bash
    • sudo mkfs.ext4 /dev/myvg/mylv
  6. Mount the ext4 File System: Create a mount point where you want to access the ext4 file system and then mount it:bash
    • sudo mkdir /mnt/myext4 sudo mount /dev/myvg/mylv /mnt/myext4
  7. Add Entry to /etc/fstab (Optional): To make the mount persistent across reboots, add an entry to the /etc/fstab file:bash
    • echo "/dev/myvg/mylv /mnt/myext4 ext4 defaults 0 2" | sudo tee -a /etc/fstab Replace /dev/myvg/mylv and /mnt/myext4 with your logical volume and mount point.
  8. Verify and Use: You can now verify that the ext4 file system is mounted correctly and start using it:bash
    • df -h This command will show you the available disk space on the mounted ext4 file system.

That’s it! You’ve created an ext4 file system on a logical volume managed by LVM. You can adjust the sizes and names to fit your specific requirements.