LINUX磁盘管理
2017-08-15 20:14
260 查看
概述:
《跟阿铭学Linux》
-i : 查看inodes使用状况
-h:显示单位为G
-k :显示单位K
-m:显示单位M
[root@iz8vb7xp3jz ~]# df -h
命令:du (用来查看某个目录或文件所占空间大小)
-a :全部文件与目录大小都列出来。如果不加任何选项和参数只列出目录(包含子目录)大小
-b: 列出的值以bytes为单位输出
-k:列出的值以kb为单位输出(默认输出的单位)
-m :列出的值以MB为单位输出
-h:系统自动调整单位。根据实际情况显示K、或G
-c:最后加总
-s : 只列出总和
[root@iz8v3jz ~]# du /home
16 /home/user1
16 /home/usertest1
16 /home/test10
16 /home/user12
20 /home/test
88 /home
命令:fdisk
-l :列出所有分区信息
[root@iz8vb7cc5e91muwr6fxp3jz ~]# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000efd2
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83886079 41942016 83 Linux
执行分区命令:
[root@iz8vb7cc5e91muwr6fxp3jz ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
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
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
-p :打印当前磁盘的分区情况
-n:建立一个新的分区
-w:保存操作(操作之后需要保存才会生效)
-q :退出
-d :删除一个分区
`-b' 分区时设定每个数据区块占用空间大小,目前支持1024, 2048 以及4096 bytes每个块。
`-i' 设定inode的大小
`-N' 设定inode数量,有时使用默认的inode数不够用,所以要自定设定inode数量。
`-c' 在格式化前先检测一下磁盘是否有问题,加上这个选项后会非常慢
`-L' 预设该分区的标签label
`-j' 建立ext3格式的分区,如果使用mkfs.ext3 就不用加这个选项了
`-t' 用来指定什么类型的文件系统,可以是ext2, ext3 也可以是ext4.
命令:e2label
用于查看或修改分区的标签
要将磁盘挂载到对应的目录下
命令:edquota (用来编辑某个用户或组的quota的值)
命令:quotaon (启动quota,在编辑好quota才能生效)
命令:quotaoff(关闭quota)
由于采用阿里云服务器,好像这些操作没有用。。。
《跟阿铭学Linux》
1、查看磁盘或者目录的容量
命令:df-i : 查看inodes使用状况
-h:显示单位为G
-k :显示单位K
-m:显示单位M
[root@iz8vb7xp3jz ~]# df -h
Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G 1.8G 36G 5% / devtmpfs 487M 0 487M 0% /dev tmpfs 497M 0 497M 0% /dev/shm tmpfs 497M 356K 496M 1% /run tmpfs 497M 0 497M 0% /sys/fs/cgroup tmpfs 100M 0 100M 0% /run/user/0
命令:du (用来查看某个目录或文件所占空间大小)
-a :全部文件与目录大小都列出来。如果不加任何选项和参数只列出目录(包含子目录)大小
-b: 列出的值以bytes为单位输出
-k:列出的值以kb为单位输出(默认输出的单位)
-m :列出的值以MB为单位输出
-h:系统自动调整单位。根据实际情况显示K、或G
-c:最后加总
-s : 只列出总和
[root@iz8v3jz ~]# du /home
16 /home/user1
16 /home/usertest1
16 /home/test10
16 /home/user12
20 /home/test
88 /home
[root@iz8v6fxp3jz ~]# du -h /home 16K /home/user1 16K /home/usertest1 16K /home/test10 16K /home/user12 20K /home/test 88K /home [root@iz8vb7cfxp3jz ~]# du -s /home 88 /home
2、磁盘的分区和格式化
命令:fdisk
-l :列出所有分区信息
[root@iz8vb7cc5e91muwr6fxp3jz ~]# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000efd2
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 83886079 41942016 83 Linux
执行分区命令:
[root@iz8vb7cc5e91muwr6fxp3jz ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
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
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
-p :打印当前磁盘的分区情况
-n:建立一个新的分区
-w:保存操作(操作之后需要保存才会生效)
-q :退出
-d :删除一个分区
3、格式化磁盘分区
命令:mke2fs, mkfs.ext2, mkfs.ext3, mkfs.ext4`-b' 分区时设定每个数据区块占用空间大小,目前支持1024, 2048 以及4096 bytes每个块。
`-i' 设定inode的大小
`-N' 设定inode数量,有时使用默认的inode数不够用,所以要自定设定inode数量。
`-c' 在格式化前先检测一下磁盘是否有问题,加上这个选项后会非常慢
`-L' 预设该分区的标签label
`-j' 建立ext3格式的分区,如果使用mkfs.ext3 就不用加这个选项了
`-t' 用来指定什么类型的文件系统,可以是ext2, ext3 也可以是ext4.
命令:e2label
用于查看或修改分区的标签
4、挂载/卸载磁盘
命令:mount要将磁盘挂载到对应的目录下
5、磁盘配额
命令:quota (每个用户的用的磁盘资源是有限制的)命令:edquota (用来编辑某个用户或组的quota的值)
命令:quotaon (启动quota,在编辑好quota才能生效)
命令:quotaoff(关闭quota)
由于采用阿里云服务器,好像这些操作没有用。。。
相关文章推荐
- Linux磁盘管理
- linux磁盘管理命令--du
- Linux磁盘管理之常用命令
- Linux磁盘管理
- linux磁盘管理
- 【鸟哥Linux学习笔记】关于Linux磁盘管理和文件系统(2)
- Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理
- Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理(一)
- Linux磁盘管理--RAID原理
- Linux磁盘管理
- linux磁盘管理和文件系统创建
- Linux磁盘管理
- 8.29_Linux磁盘管理(二)
- 学习笔记 -- linux磁盘管理
- Linux磁盘管理
- Linux学习之CentOS(二十五)--Linux磁盘管理:LVM逻辑卷基本概念及LVM的工作原理
- Linux磁盘管理
- Linux磁盘管理
- Linux磁盘管理
- linux磁盘管理知识汇总