20, linux- disk management commands df, du, mount, fdisk

Under linux disk or storage device can not be accessed directly

Specific contents of the file on all storage devices needed to mount the storage device to the next one operating system file folders, the contents of files stored by the device to access the folder or uploaded to the storage device

Under linux hard disk named sda from the beginning, followed by sdb, sdc, sdd ......

Under the hard disk partition named sda1 from the beginning, followed by sda2, sda3 ......

 

1, df command to check disk usage and disk partitions
 are: the size of the partitions that have been used to mount the amount of free file folder size usage

 

df -a: See all the disk usage, contains hidden content

df -h: Displays the maximum partition size, use the disk partition size has been used, the size of the free

 

2, du: see the space occupied folders

   du -k folder name: display units as KB

     

 

   du -m folder name: display in MB

  

 

Note: ls -l: can display the file size, folder size can not be displayed

 

3, mount: the partition is mounted to a file folder

Format: mount partition path folder path / folder name (recommended folder path starting from the root path)

Note: The folder is best to mount an empty folder

   Use mount to mount the mounted partition is only valid until the computer system shutdown reboot

   If you want to automatically mount the disk, you can add a line in / etc / fstab file

   /dev/sdb1  /usr/cipan3 ext3 default 0 0

   Partition path to mount the folder path of the file format  

 

4, fdisk command on the new hard disk partition and format

fdisk -l command to list all partitions

Usage: fdisk partition path: Enter the partition

   Command (m for help): n - n input partition

 

   
   Partition, p represents the primary input partition, e represents the input logical partition

 

   Set up their own partition number, the size of the default value space represents the entire hard disk space allocated to the partition

Note: a new hard drive must be partitioned and formatted before you can use only formatted the hard disk in order to determine the above file storage format

 

Guess you like

Origin www.cnblogs.com/z-xiao/p/11863155.html