fdisk - Partition table manipulator for Linux (分区)
fdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device
Hard disks can be divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the disk.
The device is usually one of the following:
/dev/hda
/dev/hdb
/dev/sda
/dev/sdb
(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks). A device name refers to the entire disk.
The partition is a device name followed by a partition number. For example, /dev/hda1 is the first partition on the first IDE hard disk in the system. IDE disks
can have up to 63 partitions, SCSI disks up to 15.
mkfs - build a Linux file system (格式化)
mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ]
mkfs is used to build a Linux file system on a device, usually a hard disk partition. filesys is either the device name (e.g. /dev/hda1, /dev/sdb2) or the mount
point (e.g. /, /usr, /home) for the file system. blocks is the number of blocks to be used for the file system.
In actuality, mkfs is simply a front-end for the various file system builders (mkfs.fstype) available under Linux.
-t fstype
Specifies the type of file system to be built. If not specified, the default file system type (currently ext2) is used.
mke2fs - create an ext2/ext3/ext4 filesystem
mke2fs [ -c | -l filename ] [ -b block-size ] [ -f fragment-size ] [ -g blocks-per-group ] [ -G number-of-groups ] [ -i bytes-per-inode ] [ -I inode-size ] [ -j ] [
-J journal-options ] [ -K ] [ -N number-of-inodes ] [ -n ] [ -m reserved-blocks-percentage ] [ -o creator-os ] [ -O feature[,...] ] [ -q ] [ -r fs-revision-level ]
[ -E extended-options ] [ -v ] [ -F ] [ -L volume-label ] [ -M last-mounted-directory ] [ -S ] [ -t fs-type ] [ -T usage-type ] [ -U UUID ] [ -V ] device [ blocks-
count ]
mke2fs is used to create an ext2, ext3, or ext4 filesystem, usually in a disk partition. device is the special file corresponding to the device (e.g /dev/hdXX).
blocks-count is the number of blocks on the device. If omitted, mke2fs automagically figures the file system size.
mount - mount a file system
mount [-fnrsvw] [-t vfstype] [-o options] device dir
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount
command serves to attach the file system found on some device to the big file tree. Conversely, the umount(8) command will detach it again.
The standard form of the mount command, is
mount -t type device dir
This tells the kernel to attach the file system found on device (which is of type type) at the directory dir. The previous contents (if any) and owner and mode of
dir become invisible, and as long as this file system remains mounted, the pathname dir refers to the root of the file system on device.
df - report file system disk space usage
df [OPTION]... [FILE]...
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p1 10325748 5077212 4724016 52% /
udev 32918752 909576 32009176 3% /dev
/dev/sda3 20641788 967932 18625216 5% /usr/local
/dev/sda4 255283516 26986388 215329460 12% /data
$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/cciss/c0d0p1 1311552 71240 1240312 6% /
udev 8229688 608 8229080 1% /dev
/dev/sda3 2626560 2206 2624354 1% /usr/local
/dev/sda4 32423936 11203 32412733 1% /data
stat - display file or file system status (索引节点inode)
stat [OPTION] FILE..
$ stat /
File: `/'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 801h/2049d Inode: 2 Links: 22
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-01-17 18:58:51.000000000 +0800
Modify: 2014-02-19 16:16:31.000000000 +0800
Change: 2014-02-19 16:16:31.000000000 +0800
$ stat ~/.bashrc
File: `/home/boss/.bashrc'
Size: 1178 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 1053691 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 2004/ boss) Gid: ( 100/ users)
Access: 2013-01-29 14:07:54.000000000 +0800
Modify: 2013-01-29 14:07:54.000000000 +0800
Change: 2013-01-29 14:07:54.000000000 +0800
struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* inode number */
mode_t st_mode; /* protection */
nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of owner */
gid_t st_gid; /* group ID of owner */
dev_t st_rdev; /* device ID (if special file) */
off_t st_size; /* total size, in bytes */
blksize_t st_blksize; /* blocksize for filesystem I/O */
blkcnt_t st_blocks; /* number of blocks allocated */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last modification */
time_t st_ctime; /* time of last status change */
};
The following flags are defined for the st_mode field:
S_IFMT 0170000 bitmask for the file type bitfields
S_IFSOCK 0140000 socket
S_IFLNK 0120000 symbolic link
S_IFREG 0100000 regular file
S_IFBLK 0060000 block device
S_IFDIR 0040000 directory
S_IFCHR 0020000 character device
S_IFIFO 0010000 FIFO
S_ISUID 0004000 set UID bit
S_ISGID 0002000 set-group-ID bit (see below)
S_ISVTX 0001000 sticky bit (see below)
S_IRWXU 00700 mask for file owner permissions
S_IRUSR 00400 owner has read permission
S_IWUSR 00200 owner has write permission
S_IXUSR 00100 owner has execute permission
S_IRWXG 00070 mask for group permissions
S_IRGRP 00040 group has read permission
S_IWGRP 00020 group has write permission
S_IXGRP 00010 group has execute permission
S_IRWXO 00007 mask for permissions for others (not in group)
S_IROTH 00004 others have read permission
S_IWOTH 00002 others have write permission
S_IXOTH 00001 others have execute permission
The set-group-ID bit (S_ISGID) has several special uses. For a directory it indicates that BSD semantics is to be used for that directory: files created there
inherit their group ID from the directory, not from the effective group ID of the creating process, and directories created there will also get the S_ISGID bit set.
For a file that does not have the group execution bit (S_IXGRP) set, the set-group-ID bit indicates mandatory file/record locking.
The `sticky' bit (S_ISVTX) on a directory means that a file in that directory can be renamed or deleted only by the owner of the file, by the owner of the directory,
and by a privileged process.
了解inode:http://www.ruanyifeng.com/blog/2011/12/inode.html