您现在的位置是:首页 > 文章详情

Linux查看磁盘或者目录的容量

日期:2018-04-14点击:488

查看磁盘或者目录的容量

命令 : df

“df” 查看已挂载磁盘的总容量、使用容量、剩余容量等,可以不加任何参数,默认是按k为单位显示的。

[root@localhost ~]# df 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/sda3 14347632 1490876 12127924 11% / tmpfs 163308 0 163308 0% /dev/shm /dev/sda1 99150 26808 67222 29% /boot 

“df” 常用选项有 “-i” “-h” “-k” “-m”等

“-i” 查看inodes使用状况

文件系统 Inode 已用(I) 可用(I) 已用(I)%% 挂载点 /dev/sda3 912128 66195 845933 8% / tmpfs 40827 1 40826 1% /dev/shm /dev/sda1 25688 38 25650 1% /boot 

“-h” 使用合适的单位显示,例如 ‘G’

文件系统 容量 已用 可用 已用%% 挂载点 /dev/sda3 14G 1.5G 12G 11% / tmpfs 160M 0 160M 0% /dev/shm /dev/sda1 97M 27M 66M 29% /boot 

“-k”, “-m” 分别以K, M 为单位显示

[root@localhost ~]# df -k 文件系统 1K-块 已用 可用 已用% 挂载点 /dev/sda3 14347632 1490880 12127920 11% / tmpfs 163308 0 163308 0% /dev/shm /dev/sda1 99150 26808 67222 29% /boot [root@localhost ~]# df -m 文件系统 1M-块 已用 可用 已用% 挂载点 /dev/sda3 14012 1456 11844 11% / tmpfs 160 0 160 0% /dev/shm /dev/sda1 97 27 66 29% /boot

命令 : du

“du” 用来查看某个目录或文件所占空间大小.

语法 : du [-abckmsh] [文件或者目录名] 常用的参数有:

“-a” 全部文件与目录大小都列出来。如果不加任何选项和参数只列出目录(包含子目录)大小。

[root@localhost ~]# du dirb 4 dirb/dirc 12 dirb [root@localhost ~]# du -a dirb 4 dirb/filee 4 dirb/dirc 12 dirb 

如果du不指定单位的话,默认显示单位为K.

“-b” 列出的值以bytes为单位输出。

“-k” 以KB为单位输出,和默认不加任何选项的输出值是一样的。

“-m” 以MB为单位输出

“-h” 系统自动调节单位,例如文件太小可能就几K,那么就以K为单位显示,如果大到几G,则就以G为单位显示。

[root@localhost ~]# du -b /etc/passwd 1181 /etc/passwd [root@localhost ~]# du -k /etc/passwd 4 /etc/passwd [root@localhost ~]# du -m /etc/passwd 1 /etc/passwd [root@localhost ~]# du -h /etc/passwd 4.0K /etc/passwd 

“-c” 最后加总

[root@localhost ~]# du -c dirb 4 dirb/dirc 12 dirb 12 总用量 [root@localhost ~]# du dirb 4 dirb/dirc 12 dirb 

“-s” 只列出总和

[root@localhost ~]# du -s dirb 12 dirb 

du -sh filename

磁盘的分区和格式化

  1. 先关闭正在运行的Linux系统 init 0.
  2. 到vmware的Linux虚拟机界面,点 “Edit virtual machine settings”, 点一下左侧靠下面的 “Add...” 按钮。
  3. 在左侧选中 “Hard Disk” 默认就是这一行,点右下角的 “Next”, 继续点 “Next”.
  4. “Virtual disk type” 选择 IDE, 点 “Next”
  5. 继续点 “Next”, “Disk size” 默认即可,最后点 “Finish”.

命令 : fdisk

fdisk 是Linux下硬盘的分区工具,是一个非常实用的命令,但是fdisk只能划分小于2T的分区。

语法 : fdisk [-l ] [设备名称] 选项只有一个。

“-l” 后边不跟设备名会直接列出系统中所有的磁盘设备以及分区表,加上设备名会列出该设备的分区表。

[root@localhost ~]# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes 255 heads, 63 sectors/track, 2088 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00018d63 Device Boot Start End Blocks Id System /dev/sda1 * 1 13 102400 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 13 274 2097152 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. /dev/sda3 274 2089 14576640 83 Linux Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@localhost ~]# fdisk -l /dev/sda Disk /dev/sda: 17.2 GB, 17179869184 bytes 255 heads, 63 sectors/track, 2088 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00018d63 Device Boot Start End Blocks Id System /dev/sda1 * 1 13 102400 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 13 274 2097152 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. /dev/sda3 274 2089 14576640 83 Linux 

可以看到刚才加的一块磁盘 /dev/sdb 的信息。

“fdisk” 如果不加 “-l” 则进入另一个模式,在该模式下,可以对磁盘进行分区操作。

[root@localhost ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). 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 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’, ‘d’, ‘w’, ‘q’.

“p” 打印当前磁盘的分区情况。

Command (m for help): p Disk /dev/sda: 17.2 GB, 17179869184 bytes 255 heads, 63 sectors/track, 2088 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00018d63 Device Boot Start End Blocks Id System /dev/sda1 * 1 13 102400 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 13 274 2097152 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. /dev/sda3 274 2089 14576640 83 Linux 

‘n’ 建立一个新的分区。

‘w’ 保存操作。

‘q’ 退出。

‘d’ 删除一个分区

下面阿铭会把刚才增加的磁盘/dev/sdb进行分区操作。先使用 ‘p’ 命令看一下/dev/sdb的分区状况:

[root@localhost ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xf4121235. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xf4121235 Device Boot Start End Blocks Id System Command (m for help): 

可以看到目前/dev/sdb没有任何分区,下面阿铭给它建立第一个分区:

Command (m for help): n Command action e extended p primary partition (1-4) 

使用 ‘n’ 命令新建分区,它会提示是要 ‘e’ (扩展分区) 还是 ‘p’ (主分区) [1] 阿铭的选择是 ‘p’, 于是输入 ‘p’ 然后回车

Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1044, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): +1000M 

输入 ‘p’ 后,会提示分区数,这里写 ‘1’, 因为是第一个分区,当然你也可以写 ‘2’ 或 ‘3’, 如果你直接回车的话,会继续提示你必须输入一个数字,接着又提示第一个柱面从哪里开始,默认是 ‘1’, 你可以写一个其他的数字,不过这样就浪费了空间,所以还是写 ‘1’ 吧,或者你直接回车也会按 ‘1’ 处理,接着是让输入最后一个柱面的数值,也就是说你需要给这个分区分多大空间,关于柱面是多大不再细究,你只需要掌握教给你的方法即可,即写 “+1000M”, 这样即方便又不容易出错。用 ‘p’ 查看已经多出了一个分区:

Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0600660a Device Boot Start End Blocks Id System /dev/sdb1 1 128 1028128+ 83 Linux 

继续上面的操作,一直创建主分区到4, 然后再一次创建分区的时候则会提示:

Command (m for help): n You must delete some partition and add an extended partition first 

这是因为,在linux中最多只能创建4个主分区,那如果你想多创建几个分区如何做?很容易,在创建完第三个分区后,创建第四个分区时选择扩展分区。

Command (m for help): n Command action e extended p primary partition (1-4) e Selected partition 4 First cylinder (385-1044, default 385): Using default value 385 Last cylinder, +cylinders or +size{K,M,G} (385-1044, default 1044): Using default value 1044 Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xef267349 Device Boot Start End Blocks Id System /dev/sdb1 1 128 1028128+ 83 Linux /dev/sdb2 129 256 1028160 83 Linux /dev/sdb3 257 384 1028160 83 Linux /dev/sdb4 385 1044 5301450 5 Extended 

扩展分区,在最后一列显示为 “Extended”, 接下来继续创建分区:

Command (m for help): n First cylinder (385-1044, default 385): Using default value 385 Last cylinder, +cylinders or +size{K,M,G} (385-1044, default 1044): +1000M Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xef267349 Device Boot Start End Blocks Id System /dev/sdb1 1 128 1028128+ 83 Linux /dev/sdb2 129 256 1028160 83 Linux /dev/sdb3 257 384 1028160 83 Linux /dev/sdb4 385 1044 5301450 5 Extended /dev/sdb5 385 512 1028128+ 83 Linux 

这时候再分区和以前有区别了,不再选择是主分区还是扩展分区了,而是直接定义大小。有一点要讲一下,当分完三个主分区后,第四个扩展分区需要把剩余的磁盘空间全部划分给扩展分区,不然的话剩余的空间会浪费,因为分完扩展分区后,再划分新的分区时是在已经划分的扩展分区里来分的。其中/dev/sdb4为扩展分区,这个分区是不可以格式化的,你可以把它看成是一个空壳子,能使用的为/dev/sdb5, 其中/dev/sdb5为/dev/sdb4的子分区,这个子分区叫做逻辑分区。如果你发现分区分的不合适,想删除掉某个分区怎么办?这就用到了 ‘d’ 命令:

Command (m for help): d Partition number (1-5): 1 Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb2 129 256 1028160 83 Linux /dev/sdb3 257 384 1028160 83 Linux /dev/sdb4 385 1044 5301450 5 Extended /dev/sdb5 385 512 1028128+ 83 Linux Command (m for help): d Partition number (1-5): 5 Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb2 129 256 1028160 83 Linux /dev/sdb3 257 384 1028160 83 Linux /dev/sdb4 385 1044 5301450 5 Extended Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (385-1044, default 385): Using default value 385 Last cylinder, +cylinders or +size{K,M,G} (385-1044, default 1044): +1000M Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb2 129 256 1028160 83 Linux /dev/sdb3 257 384 1028160 83 Linux /dev/sdb4 385 1044 5301450 5 Extended /dev/sdb5 385 512 1028128+ 83 Linux Command (m for help): d Partition number (1-5): 4 Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb2 129 256 1028160 83 Linux /dev/sdb3 257 384 1028160 83 Linux 

输入 ‘d’ 会提示要删除哪个分区,可以选择从 1-5 其中1-3是主分区(sdb1, sdb2, sdb3),4是扩展分区(sdb4),5是逻辑分区 [1] (sdb5),如果输入5,则直接把逻辑分区sdb5删除掉,但是如果输入4的话,会把整个扩展分区sdb4干掉,当然也包含扩展分区里面的逻辑分区sdb5。在刚才的分区界面直接 Ctrl + C 退出来,这样刚刚的分区全部都取消了,咱们重新来做分区:

[root@localhost ~]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 1 First cylinder (1-1044, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): 1044 Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb1 1 1044 8385898+ 5 Extended Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) 

如果把第一个分区分为扩展分区,并且把全部空间都分给扩展分区的话,再继续分区的话,会提示的分区类型为主分区还是逻辑分区(logical), 用 ‘l’ 表示逻辑分区,逻辑分区的id是从5开始的,因为前四个id为主分区或者扩展分区。既然把所有磁盘空间都分为了扩展分区,如果你在这里选择 ‘p’ 则会报错:

Command action l logical (5 or over) p primary partition (1-4) p Partition number (1-4): 2 No free sectors available 

这是因为没有足够空间分给主分区了,那我们就分逻辑分区:

Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (1-1044, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): +1000M Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb1 1 1044 8385898+ 5 Extended /dev/sdb5 1 128 1028097 83 Linux Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (129-1044, default 129): 129 Last cylinder, +cylinders or +size{K,M,G} (129-1044, default 1044): +1000M Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb1 1 1044 8385898+ 5 Extended /dev/sdb5 1 128 1028097 83 Linux /dev/sdb6 129 256 1028128+ 83 Linux 

分区完后,需要输入 ‘w’ 命令来保存我们的配置:

Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. 

再使用 fdisk -l /dev/sdb 查看分区情况:

[root@localhost ~]# fdisk -l /dev/sdb Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7b9a6af3 Device Boot Start End Blocks Id System /dev/sdb1 1 1044 8385898+ 5 Extended /dev/sdb5 1 128 1028097 83 Linux /dev/sdb6 129 256 1028128+ 83 Linux 

通过以上操作,相信你也学会了用fdisk来分区了吧。但要提醒你,不要闲着没事分区玩儿,这操作的危险性是很高的,一不留神就把服务器上的数据全部给分没有了。所以在你执行分区操作的时候,请保持百分之二百的细心,切记切记!

格式化磁盘分区

命令 : mke2fs, mkfs.ext2, mkfs.ext3, mkfs.ext4

当用man查询这四个命令的帮助文档时,你会发现我们看到了同一个帮助文档,这说明四个命令是一样的。mke2fs常用的选项有:

‘-b’ 分区时设定每个数据区块占用空间大小,目前支持1024, 2048 以及4096 bytes每个块。

‘-i’ 设定inode的大小

‘-N’ 设定inode数量,有时使用默认的inode数不够用,所以要自定设定inode数量。

‘-c’ 在格式化前先检测一下磁盘是否有问题,加上这个选项后会非常慢

‘-L’ 预设该分区的标签label

‘-j’ 建立ext3格式的分区,如果使用mkfs.ext3 就不用加这个选项了

‘-t’ 用来指定什么类型的文件系统,可以是ext2, ext3 也可以是 ext4.

[root@localhost ~]# mke2fs -t ext4 /dev/sdb5 mke2fs 1.41.12 (17-May-2010) 文件系统标签= 操作系统:Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 64256 inodes, 257024 blocks 12851 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=264241152 8 block groups 32768 blocks per group, 32768 fragments per group 8032 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 正在写入inode表: 完成 Creating journal (4096 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 24 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 

指定文件系统格式为ext4, 该命令等同于 mkfs.ext4 /dev/sdb5. 目前CentOS 6 默认文件系统格式为ext4, 所以以后你遇到需要格式磁盘分区的时候,直接指定格式为ext4即可,但早期的版本CentOS 5 是使用ext3作为默认的文件系统的,所以你可以根据操作系统的版本来决定格式化什么格式的文件系统。在上面的例子中,你是否有注意到一些指标呢?其中一个指标是 “块大小=4096” 这里涉及到一个 “块” 的概念,磁盘在被格式化的时候会预先规定好每一个块的大小,然后再把所有的空间分割成一个一个的小块,存数据的时候也是一个块一个块的去写入。所以如果你的磁盘存的都是特别小特别小的文件,比如说1k或者2k,那么建议在格式化磁盘的时候指定块数值小一点。ext文件系统默认块大小为4096也就是4k. 在格式化的时候,可以指定块大小为1024, 2048, 4096(它们是成倍增加的),虽然格式化的时候可以指定块大小超过4096,但是一旦超过4096则不能正常挂载,如何指定块大小?

[root@localhost ~]# mke2fs -t ext4 -b 8192 /dev/sdb5 Warning: blocksize 8192 not usable on most systems. mke2fs 1.41.12 (17-May-2010) mke2fs: 8192-byte blocks too big for system (max 4096) 无论如何也要继续? (y,n) y Warning: 8192-byte blocks too big for system (max 4096), forced to continue 文件系统标签= 操作系统:Linux 块大小=8192 (log=3) 分块大小=8192 (log=3) Stride=0 blocks, Stripe width=0 blocks 64256 inodes, 128512 blocks 6425 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=134201344 2 block groups 65528 blocks per group, 65528 fragments per group 32128 inodes per group Superblock backups stored on blocks: 65528 正在写入inode表: 完成 Creating journal (4096 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 This filesystem will be automatically checked every 28 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 

指定块大小为8192会提示,块值设置太大了,我们直接输入 ‘y’ 强制格式化,你还可以尝试指定更大的数字。

[root@localhost ~]# mke2fs -t ext4 -L TEST -b 8192 /dev/sdb5 

可以使用 ‘-L’ 来指定标签。标签会在挂载磁盘的时候使用,另外也可以写到配置文件里,稍后阿铭介绍。关于格式化的这一部分,建议你除非有需求,否则不需要指定块大小,也就是说,你只需要记住这两个选项: ‘-t’ 和 ‘-L’ 即可。

命令 : e2label

用来查看或修改分区的标签,阿铭很少使用,你只要了解一下即可。

[root@localhost ~]# e2label /dev/sdb5 TEST [root@localhost ~]# e2label /dev/sdb5 TEST123 [root@localhost ~]# e2label /dev/sdb5 TEST123
原文链接:https://www.centoschina.cn/course/introduction/10230.html
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章