Linux, AIX file system creation comparison __linux

Source: Internet
Author: User
Tags extend mkdir
the creation and mounting method of Linux file system 1 creation of Linux file Systems

When the Linux operating system installs the server, the installer has created its own file system, but after using it for a while,


As the increase in user and software systems makes disk space more and more tense, network administrators are required to extend the existing file system.


There are two ways to extend a file system:


One is to extend the file system using disk space not currently available on the system. This is rare, however, because when a server is purchased, the Linux operating system will use all of the disk's space;


The other is to purchase a new disk installed on the server to extend the file system space, this method is most common, such as: The new installed on the server disk is a second SCSI disk, after the installation boot system can not immediately use, or even see it,


You need to create a file system after the following procedure to work properly:

The first step is to log on to the root account and start HyperTerminal, and after the system prompt "#", use the fdisk–l command to view the partition of the local disk, to determine the presence of the new disk in the system (that is,/dev/sdb), and if not, check that the hard drive is properly installed.


The second step is to use the FDISK command to create a new file system partition on the new disk (/DEV/SDB) (Specific command: #fdisk/dev/sdb). In the FDISK command menu, select the N option to establish a new file system partition, you can create one can also create multiple, depending on the specific needs, where the assumption is to create a new file system partition (that is,/DEV/SDB1), and then select the W option to save the partition state. (for the use of the Fdisk disk partitioning tool, refer to the relevant books).

The third step is to format the newly created file system partition/DEV/SDB1. Command is: #mkfs –t ext3/dev/sdb1

It should be explained in this step that the-t parameter is used to specify the file system format, and the commonly used file system formats are: ext2 (second extended file system, Redhat version prior to 2001); Ext3 (second extended file system, current default format); Vfat (equivalent to Windows FAT32 format); If you want to format it as a swap space for your Linux system, you can type a command: #mkswap/dev/sdb1, we don't need it here. At this point, the creation of the new file system is complete. 2 Mount of newly created file system

The newly created file system cannot be used until it is hooked up to the original file system. This differs from the Windows class operating system because the Linux file system has only one root directory "/" and other file systems must be attached to a directory in the root file system to be used, which is the mount point, Also known as the Mount directory. The mount steps are as follows:

The first step is to create a mount point directory for this newly created file system (/DEV/SDB1). Typically, a mount directory is established under the MNT directory of the root file system (that is,/mnt), or in other locations, where we create a new mount directory (such as:/extdsk) in the root directory. Use command # MKDIR/EXTDSK (catalog name can be customized).

The second step is to make sure that when you mount the directory, you need to add a disk flag for the new file system/DEV/SDB1, which is important when you need to mount the file system automatically, the default/etc/fstab file uses disk flags, and the partition command fdisk and the formatting command mkfs do not add this flag. This flag should be the full pathname of the Mount directory, this should be done using the command #e2label/dev/sdb1/extdsk,/extdsk in the command is the disk flag name.

The third step, using the Mount command, this new file system/DEV/SDB1 mount to the Mount directory/extdsk, the command format is: #mount –t Ext3/dev/sdb1/extdsk

It should be explained in this step that if the Ext3 file system format is included in the/etc/filesystems file, the "-t ext3" argument in the command can be omitted without writing, and the command automatically finds the appropriate format for the/DEV/SDB1 partition. It is also necessary to note that after this step, you can use the DF or du command to view information about the new file system/DEV/SDB1, and you can use the newly created file system by entering the Mount directory/extdsk. However, if you restart the Linux system at this point, you also need to type the mount command above in the terminal window to reload the file system so that the newly created file system is automatically loaded at Linux startup, and you must do the fourth step below.

The fourth step is to add this newly created file system/dev/sdb1 to the/etc/fstab file and set it to boot automatically, which eliminates the hassle of manually loading the file system every time you reboot the system. You can use the "vi/etc/fstab" command to add the following row to the file, and then save the Exit VI Editor:

/dev/sdb1/extdsk ext3 Defaults 1 2


Summary of the use of E2label E2label can get the volume label for a device partition. For example, to obtain the/DEV/SDA1 volume label:

E2label/dev/sda1

E2label can also set the volume label of a partition for a device. For example, set the/DEV/SDA1 volume label to/DIRA1

E2label/dev/sda1/dira1

You can then use the volume label to mount the file system

# Mount Label=/dira1/mnt/dira1

The advantage of this approach is that the kernel can still mount the partition correctly when you swap the hard drive from one of the motherboard's interfaces to another interface


As a system configuration file, Fstab is typically located in the/etc directory, which includes information about all partitions and storage devices, and where they should be mounted and how to mount them.

/DEV/SDA9 Swap Defaults 0 0
label=//ext3 Defaults 1 1
Label=/boot/boot ext3 Defaults 1 2

1th column: Equipment name, the problem comes, label=/, depend on, this is what equipment ah, e2label/dev/sda8, show/, know, originally/DEV/SDA8 is/ah, really racking
2nd Column: mount point
3rd column: File system type
4th Column: Mount parameters, Defaults=rw,suid,dev,exec,auto,nouser,and async
5th column: Dump parameter, 0 is not checked. Dump checks this parameter to determine if the file system is to be backed up
The 6th column, fsck's sequential parameters, when the system starts, the FSCK command detects the field to determine the order in which the file system scans, and the value of the root file system/pair should be 1, and the other file system should be 2. Set this field to 0 if the file system does not need to scan for a check at startup.

E2label can change the label name of a device, such as: E2label/dev/hda3/, set the/dev/hda3 partition's label name to/
Note: The root parameter in the grub.conf file can use the partition device name, or you can use the partition label name, such as:
Title Fedora Core (2.6.18-1.2798.FC6)
Root (hd0,0)
Kernel/vmlinuz-2.6.18-1.2798.fc6 ro root=label=/rhgb quiet
Initrd/initrd-2.6.18-1.2798.fc6.img



Installing the Oracle database RAC requires that the swap partitions of the two machines be identical, and if this is not the case, you need to manually create the swap partition.

Here are two ways to create swap

First of all, Swapoff-a #停止所有的swap分区

A new disk partition as a swap partition

1. Use the FDISK command (example: # FDISK/DEV/SDB) to partition the disk, add a swap partition, create a new partition, and use the "T" command in Fdisk to change the newly added partition ID to (Linux swap type)

2. # MKSWAP/DEV/SDB1 #格式化swap分区, here's the sdb2 to see the actual partition device name shown after you add the P command

3. # SWAPON/DEV/SDB1 #启动新的swap分区

4. Allow the system to start automatically enable this swap partition, you can edit/etc/fstab, add the following line
/DEV/SDB1 Swap Defaults 0 0

Second, use the file as swap partition

1. Create a file to be a swap partition: increase the 1GB size of the swap partition, the command is written as follows, where count equals the number of blocks (bs*count= file size) you want.
# dd If=/dev/zero of=/root/swapfile bs=1m count=1024

2. Format to swap the partition file:
# Mkswap/root/swapfile #建立swap的文件系统

3. Enable swap partition files:
# Swapon/root/swapfile #启用swap文件

4. Enable the system to boot, add a line to the file/etc/fstab:
/root/swapfile Swap Defaults 0 0

When you are done, use FREE-G to view the following


The main steps for AIX to add a disk and create a file system above:

Connect the disk to the system (host power down, hard drive, reboot)

Define a disk as a physical volume (automatically assign a volume label name such as Hdisk1)

Add a physical volume to a volume group, or create a new volume group on a physical volume; (EXTENDEVG/MKVG VARYONVG)

Create a logical volume and modify the corresponding attributes as needed, such as whether to mirror, or to place on disk; (MKLV)

Creates a file system on a logical volume. If you do not want to implement a logical volume before creating a file system, AIX also provides the option to automatically create logical volumes; (CRFS/MKPS)

Mount the file system; (Mount)

AIX Create File system

First use CRFs or Smit to create a 20G file system, since the following to use some low-level commands to create the file system, so here with CRFs to complete the creation of the file system

# crfs-v jfs2-g testvg-a size=20g-m/testfs

Explanation: Create a file system with a 20G size format of JFS2 on the TESTVG volume group, with mount points as/testfs
Creation of file system under AIX system

Next, use the MKLV mkfs chlv logform Mount CHFS These commands to step through the work done by CRFs.

Create LV, the name of LV is TESTLV, subordinate volume group is TESTVG, because TESTVG pp size=512m, therefore allocate 40 PP for TESTLV.

# mklv-y testlv-t JFS2 TESTVG 40
Creation of file system under AIX system

Format TESTLV into a JFS2 system

# mkfs-v JFS2/DEV/TESTLV
Creation of file system under AIX system

Create a new LV, name LOGLV, and assign 2 pp

# mklv-y LOGLV TESTVG 2

Then modify the LOGLV to the Jfs2log format

# chlv-t Jfs2log LOGLV


Creation of file system under AIX system

Use the Logform command to format the LOGLV as a JFS2 log system.

# logform-v JFS2/DEV/LOGLV
Creation of file system under AIX system

Create the mount point/TESTFS1 and mount the TESTLV onto the TESTFS1.

# mkdir/testfs1# Mount-o LOG=/DEV/LOGLV/DEV/TESTLV/TESTFS1
Creation of file system under AIX system

Mount the/testfs, and then view the status of the two file systems through the DF-G command.

# Mount/testfs

# df-g

Analyzing the following figure, you can see that the file system created by the previous commands has the same effect as the file system created by the CRFs command, in fact CRFs or Smit invokes the above commands to implement the file system creation.
Creation of file system under AIX system


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.