Linux File System Management

Source: Internet
Author: User

Linux File System Management

Operating System: RHEL6.4-64

Add 30 GB disks to the Linux operating system (Virtual Machine)

Partition, the first primary partition is 18 GB, formatted as an ext4 file system, mounted to/u01

To enable system restart (automatic mounting upon startup), use LABEL for mounting.

1.1.1 confirm disk devices in the system

Df-Th to view the current file system usage

[Root @ rhel64 ~] # Df-Th

View the current disk device and partition information

[Root @ rhel64 ~] # Fdisk-cul

1.1.2 add 30 gb scsi disk

Disable the Operating System

[Root @ rhel64 ~] # Shutdown-h now

Add a SCSI controller to the storage.

Add a 30 GB disk to the SCSI controller.

After the disk is added, start the virtual machine operating system.

1.1.3 view disk device information

[Root @ rhel64 ~] # Fdisk-cul

After each restart, the disk name may change.

After this restart, the new disk name is/dev/sda.

1.1.4 partition fdisk

View Newly Added Disk Partitions

[Root @ rhel64 ~] # Fdisk-cul/dev/sda

[Root @ rhel64 ~] # Fdisk/dev/sda

Prompt that cu is recommended. Press m to help and exit q.

Use fdisk-cu to partition again

[Root @ rhel64 ~] # Fdisk-cu/dev/sda

M.

N add new partition p primary partition 1 first sector press ENTER laster sector input partition size + 18 GB by default

M view help p print the current Partition Table

M view help w save Partition Table

View new disk partitions again

[Root @ rhel64 ~] # Fdisk-cul/dev/sda

View corresponding devices

[Root @ rhel64 ~] # Ll/dev/sda *

1.1.5 format mkfs. ext4

Enterprise 6 uses the ext4 File System by default

[Root @ rhel64 ~] # Mkfs. ext4/dev/sda1

1.1.6 marking e2label

[Root @ rhel64 ~] # E2label

[Root @ rhel64 ~] # E2label/dev/sda1 u01

View the volume label and UUID

[Root @ rhel64 ~] # Blkid

1.1.7 create a mount point

A mount point is essentially a directory and an entry to access disk partitions.

[Root @ rhel64 ~] # Mkdir/u01

[Root @ rhel64 ~] # Ls-ld/u01

1.1.8 temporary mounting

Create File file1 in/u01 before mounting

[Root @ rhel64 ~] # Touch/u01/file1

[Root @ rhel64 ~] # Ll/u01

View the file system. At this time,/u01 is just a common directory, occupying/file system space

[Root @ rhel64 ~] # Df-Th

Mount/dev/sda1 to/u01 using the mount command

[Root @ rhel64 ~] # Mount/dev/sda1/u01

[Root @ rhel64 ~] # Df-Th

After mounting,/u01 is a separate file system, which corresponds to a hard disk partition and has its own independent disk space.

View/u01, The file1 file is not displayed

[Root @ rhel64 ~] # Ll/u01

1.1.9 uninstall the File System

Create File file2 in/u01 before uninstalling

[Root @ rhel64 ~] # Touch/u01/file2

[Root @ rhel64 ~] # Ll/u01

Unmount/u01 File System View/u01 file, the previous file1 file2 is not displayed

[Root @ rhel64 ~] # Umount/u01

[Root @ rhel64 ~] # Df-Th

[Root @ rhel64 ~] # Ll/u01

1.1.10 write/etc/fstab to enable automatic mounting at system startup

View the configuration file/etc/fstab

[Root @ rhel64 ~] # Cat/etc/fstab

Back up the configuration file and add new entries to the configuration file.

[Root @ rhel64 ~] # Cp/etc/fstab. bak

[Root @ rhel64 ~] # Vi/etc/fstab

G. move the cursor quickly to the last line, and insert the cursor to the next line. You can use the Tab key to separate and align the cursor.

LABEL = u01/u01 ext4 defaults 0 0

You can use the LABEL or UUID to mount the disk.

Do not use the following Mount Method !!!

The current status is correct. After the disk is restarted, the disk name may change. After a 30 GB new disk is restarted, it may change to/dev/sdb !!!

/Dev/sda1/u01 ext4 defaults 0 0

Check the file system and mount the file with mount/u01. If the/etc/fstab configuration is correct, mount the file normally.

[Root @ rhel64 ~] # Df-Th

[Root @ rhel64 ~] # Mount/u01

[Root @ rhel64 ~] # Df-Th

[Root @ rhel64 ~] # Ll/u01

1.1.11 shut down the operating system and restart Verification

[Root @ rhel64 ~] # Shutdown-h now

[Root @ rhel64 ~] # Df-Th

The/u01 file system is displayed, indicating that the automatic mounting is successfully restarted.

Note: The disk partition corresponding to/u01 is displayed as/dev/sdb1, indicating that the 30 GB disk name is/dev/sdb after this shutdown and restart!

It may also be/dev/sda. The name is determined based on the disk response sequence.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • Next Page
[Content navigation]
Page 1: disk partitioning, formatting, and mounting-volume label mounting Page 1: disk partitioning, formatting, and mounting-UUID mounting
Page 7: uninstall the accessed file system-fuser command

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.