[root@localhost ~]# cat /etc/filesystems //查看centos7所支持的系統格式 xfs //系統默認的支持的格式 ext4 ext3 ext2 nodev proc nodev devpts iso9660 vfat hfs hfsplus * [root@localhost ~]#
[root@localhost ~]# df -h 文件系統 容量 已用 可用 已用% 掛載點 /dev/sda3 18G 1.2G 17G 7% / devtmpfs 483M 0 483M 0% /dev tmpfs 493M 0 493M 0% /dev/shm tmpfs 493M 6.8M 486M 2% /run tmpfs 493M 0 493M 0% /sys/fs/cgroup /dev/sda1 197M 109M 88M 56% /boot tmpfs 99M 0 99M 0% /run/user/0
[root@localhost ~]# fdisk -l 磁盤 /dev/sda:21.5 GB, 21474836480 字節,41943040 個扇區 Units = 扇區 of 1 * 512 = 512 bytes 扇區大小(邏輯/物理):512 字節 / 512 字節 I/O 大小(最小/最佳):512 字節 / 512 字節 磁盤標籤類型:dos 磁盤標識符:0x000c928b 設備 Boot Start End Blocks Id System /dev/sda1 * 2048 411647 204800 83 Linux /dev/sda2 411648 4605951 2097152 82 Linux swap / Solaris /dev/sda3 4605952 41943039 18668544 83 Linux 磁盤 /dev/sdb:10.7 GB, 10737418240 字節,20971520 個扇區 Units = 扇區 of 1 * 512 = 512 bytes 扇區大小(邏輯/物理):512 字節 / 512 字節 I/O 大小(最小/最佳):512 字節 / 512 字節 磁盤標籤類型:dos 磁盤標識符:0x3ca78df9 設備 Boot Start End Blocks Id System /dev/sdb1 2048 16779263 8388608 83 Linux
[root@localhost ~]# echo 1 > 2.txt [root@localhost ~]# ls =lh 2.txt ls: 沒法訪問=lh: 沒有那個文件或目錄 2.txt [root@localhost ~]# ls -lh 2.txt //查看文件的大小 -rw-r--r--. 1 root root 2 11月 3 15:48 2.txt [root@localhost ~]# du -sh 2.txt //查看塊大小 4.0K 2.txt [root@localhost ~]# du -sb 2.txt 2 2.txt
這裏會看到ls -lh和du -sb查看文件的大小相同 而ls -lh查看的是文件的大小,du -sh 查看是塊的大小
修改文件文件系統兩種命令node
[root@localhost ~]# mke2fs -t ext4 -b 2048 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) 文件系統標籤= OS type: Linux 塊大小=2048 (log=1) 分塊大小=2048 (log=1) Stride=0 blocks, Stripe width=0 blocks 524288 inodes, 4194304 blocks 209715 blocks (5.00%) reserved for the super user 第一個數據塊=0 Maximum filesystem blocks=272629760 256 block groups 16384 blocks per group, 16384 fragments per group 2048 inodes per group Superblock backups stored on blocks: 16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104, 2048000, 3981312 Allocating group tables: 完成 正在寫入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 [root@localhost ~]#
[root@localhost ~]# mkfs.ext4 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) 文件系統標籤= OS type: Linux 塊大小=4096 (log=2) 分塊大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 524288 inodes, 2097152 blocks 104857 blocks (5.00%) reserved for the super user 第一個數據塊=0 Maximum filesystem blocks=2147483648 64 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tables: 完成 正在寫入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 [root@localhost ~]#
[root@localhost ~]# mkfs.xfs -f /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=524288 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=2097152, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@localhost ~]#
[root@localhost ~]# mke2fs -t xfs -b 2048 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) Your mke2fs.conf file does not define the xfs filesystem type. Aborting...
[root@localhost ~]# blkid /dev/sdb1 /dev/sdb1: UUID="ebdc3a7b-d16d-4bd8-8019-275e587d359e" TYPE="xfs"
[root@hf-01 ~]# mke2fs -b 8194 /dev/sdb1 Warning: blocksize 8194 not usable on most systems. mke2fs 1.42.9 (28-Dec-2013) mke2fs: 8192-byte blocks too big for system (max 4096) 不管如何也要繼續? (y,n) n [root@hf-01 ~]# mke2fs -b 2048 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) 文件系統標籤= OS type: Linux 塊大小=2048 (log=1) 分塊大小=2048 (log=1) Stride=0 blocks, Stripe width=0 blocks 327680 inodes, 2621440 blocks 131072 blocks (5.00%) reserved for the super user 第一個數據塊=0 Maximum filesystem blocks=540016640 160 block groups 16384 blocks per group, 16384 fragments per group 2048 inodes per group Superblock backups stored on blocks: 16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104, 2048000 Allocating group tables: 完成 正在寫入inode表: 完成 Writing superblocks and filesystem accounting information: 完成
[root@hf-01 ~]# mke2fs -t ext4 -m 1 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) 文件系統標籤= OS type: Linux 塊大小=4096 (log=2) 分塊大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 327680 inodes, 1310720 blocks 13107 blocks (1.00%) reserved for the super user 第一個數據塊=0 Maximum filesystem blocks=1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: 完成 正在寫入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成
[root@hf-01 ~]# mke2fs -i 8192 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) 文件系統標籤= OS type: Linux 塊大小=4096 (log=2) 分塊大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 1310720 blocks 65536 blocks (5.00%) reserved for the super user 第一個數據塊=0 Maximum filesystem blocks=1342177280 40 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736 Allocating group tables: 完成 正在寫入inode表: 完成 Writing superblocks and filesystem accounting information: 完成 [root@hf-01 ~]#