Linux disk commands (partition, view, and other commands)

Source: Internet
Author: User

(1) disk free (view disk usage and the location where the file system is mounted)
DF

Shown as follows:
File System 1 K-block used available % mount point
/Dev/sda2 2672264 2473244 63272 98%/
/Dev/sda1 101089 9233 86637 10%/boot
None 79012 0 79012 0%/dev/SHM

 

 

(2) disk usage (display space usage, including files and directory files)
Du-H directory name (h -- human readable)

Shown as follows:
8.0 K./. KDE/autostart
12 K./. KDE
4.0 K./. gnome2/accels
8.0 K./. gnome2/share/Fonts
8.0 K./. gnome2/share/cursor-Fonts
20 K./. gnome2/share
4.0 K./. gnome2/Nautilus-Scripts
28 K./. gnome2/panel2.d/default/launchers
32 K./. gnome2/panel2.d/Default
36 K./. gnome2/panel2.d
76 K./. gnome2
48 k./. pyinput

Du-SH Directory Name (s -- Summary)
Displays the total size of a directory.

 

(3) Partition
Fdisk-l view all disks

Shown as follows:
Disk/dev/SDA: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device boot start end blocks ID system
/Dev/sda1*1 13 104391 83 Linux
/Dev/sda2 14 351 2714985 83 Linux
/Dev/sda3 352 391 321300 82 Linux swap

Disk/dev/SDB: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Disk/dev/SDB doesn' t contain a valid Partition Table

Fdisk-L/dev/SDA view SDA disk Information

Partition operation:
Fdisk/dev/SDB

A toggle a bootable flag
B edit BSD disklabel
C toggle the DOS compatibility flag
* D delete a partition
L List known partition types
* M print this menu
* N Add a new partition
O create a new empty DOS partition table
* P print the Partition Table
Q quit without saving changes
S create a new empty sun disklabel
* T change a partition's System ID (Change partition type)
U change display/entry units
* V verify the Partition Table
* W write table to disk and exit
X extra functionality (experts only)

(4) Format
Mkfs. BFS mkfs. ext2 mkfs. JFS mkfs. msdos mkfs. vfatmkfs. cramfs mkfs. ext3 mkfs. minix mkfs. reiserfs mkfs. XFS and other commands to format partitions
For example, if you want to format sdb1 as an ext3 file system, enter it;
Mkfs. ext3/dev/sdb1

(5) mount a File System
Mount/dev/sdb1/mnt/sdb1
Umount/mnt/sdb1
But it will not be automatically mounted after the restart.

Edit file/etc/fstab
Add/dev/sdb1/OPT ext3 defaults 0 0

 

 

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.