Linux notes on disk and file system operations

Source: Internet
Author: User
Article Title: linux notes on disk and file system operations. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

View disk and directory capacity

Df-h

Du-h (h is easy to read)

Connection file ln hard connection or actual connection: add the associated data of the file in a directory

Symbolic connection

Disk Partition: fdisk [-l] device name

Delete partition d, add partition n, output partition p, exit without saving q, write to partition table w

Format partition: mke2fs-B sets the block size.

-I: Set inode.

-L "abc" is used to mark the volume

-J format to ext3 (with logs)

Disk inspection: fsck [-AtCary]

Badblocks [-svw]

Disk loading and detaching:

Mount-

Mount-t iso9660/dev/cdrom/mnt/cdrom mounting Optical Drive

If the-t parameter is not added, the system will take the initiative to test whether to load the content specified in/etc/fstab.

Uninstall: umount/dev/hdb5

Umount/mnt/hdb5 followed by the device number or loading point-f force

Then run df to check whether the unmount is successful.

Modify disk parameters:

Mknod

E2label modifies the disk volume label. When loading a file system, you can use the volume label instead of the disk number (/dev/hdb5)

E2label/dev/hdb5 hdb5

Tune2fs

Tune2fs [-jlL] device No.-j can be converted to the disk format

Hdparm DMA mode can improve the hard disk reading performance and enable the DMA mode

Hdparm [-icdmXTt] device name

Start loading:

Load a floppy disk:

Mount-t ext2/dev/fd0/media/floppy

Mount-t vfat/dev/fd0/media/floppy

Umount/media/floppy

Load windows Disk:

Mkdir/mnt/win98

Mount-t vfat/dev/hda1/mnt/win98

Mount-t vfat-o igcharest = cp950/dev/hda1/mnt/win98

Load the USB flash drive: You can first look at the partition fdisk-l

Mkdir/mnt/usb

Mount-t vfat/dev/sda1/mnt/usb

Virtual Memory:

Add virtual memory: one is to create a virtual memory partition, and the other is to create a virtual memory file.

Device creation method:

1. Create a partition in fdisk/dev/hda5 and change its ID to 82.

2. Format mkswap/dev/dha5

3. swapon/dev/hda5 startup

4. swapoff

Create a virtual memory file:

1. dd create a swap file dd if =/dev/zero of =/tmp/swap bs = 4 k count = 16382

2. Format mkswap/tmp/swap

3. swapon start the file swapon/tmp/swap

4. swapoff disable the file swapoff/tmp/swap

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.