Linux學(xué)習(xí)第六周


一、自建yum倉庫,分別為網(wǎng)絡(luò)源和本地源;

配置本地源
  1. 建立本地源目錄;
   [root@localhost ~]#mkdir /mnt/cdrom
   [root@localhost ~]#mkdir /yum
  1. 掛載Centos光盤;
   [root@localhost ~]#mount /dev/cdrom /mnt/cdrom
   [root@localhost ~]cp -r /mnt/cdrom/* /yum
  1. 備份repo;
   [root@localhost ~]#cd /etc/yum.repo.d/
   [root@localhost yum.repos.d]#mkdir backup
   [root@localhost yum.repos.d]#mv CentOS-Base.repo CentOS-CR.repo CentOS-Vault.repo CentOS-Vault.repo ./backup
  1. 編輯Centos-Media.repo;
  [root@localhost yum.repos.d]#cat Centos-Media.repo

[base]
name=Centos
baseurl=file:///yum
enable=1
gpgckeck=0
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7

  1. 清除yum緩存;
 [root@localhost yum.repos.d]#yum clean all
配置網(wǎng)絡(luò)源
  1. 備份源鏡像文件;
    [root@localhost yum.repos.d]# mv centos* ./backup
  1. 下載阿里云的鏡像到/etc/yum.repos.d/;
    [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo

(地址:http://mirrors.aliyun.com/repo/Centos-7.repo)

  1. 清除yum緩存;
    [root@localhost yum.repos.d]# yum clean all
    [root@localhost yum.repos.d]# yum makecache

二、編譯安裝http2.4,實現(xiàn)可以正常訪問;

關(guān)閉防火墻和selinux:http://www.itdecent.cn/p/97c3c4012c4c

1、在 Apache 官網(wǎng)下載最新版的http2.4

2、服務(wù)器端下載;

[root@localhost yum.repos.d]# cd /usr/local/src
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.43.tar.gz
--2020-07-14 14:43:05--  https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.43.tar.gz
正在解析主機(jī) mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在連接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已連接。
已發(fā)出 HTTP 請求,正在等待回應(yīng)... 200 OK
長度:9348230 (8.9M) [application/x-gzip]
正在保存至: “httpd-2.4.43.tar.gz”

100%[==============================================================================================>] 9,348,230   1.96MB/s 用時 4.5s

2020-07-14 14:43:10 (1.96 MB/s) - 已保存 “httpd-2.4.43.tar.gz” [9348230/9348230])

[root@localhost src]# ls
httpd-2.4.43.tar.gz  nginx-1.14.2  nginx-1.14.2.tar.gz

3、解包;

[root@localhost src]# tar xzvf httpd-2.4.43.tar.gz
[root@localhost src]# ll
總用量 10128
drwxr-sr-x 11 root   40    4096 3月  26 22:46 httpd-2.4.43
-rw-r--r--  1 root root 9348230 3月  30 22:21 httpd-2.4.43.tar.gz
drwxr-xr-x  9 1001 1001     186 6月  13 14:45 nginx-1.14.2
-rw-r--r--  1 root root 1015384 12月  4 2018 nginx-1.14.2.tar.gz
[root@localhost src]# cd httpd-2.4.43/
[root@localhost httpd-2.4.43]# ls
ABOUT_APACHE     ap.d          CHANGES         docs         httpd.spec      libhttpd.dep  Makefile.win   README            srclib
acinclude.m4     build         CMakeLists.txt  emacs-style  include         libhttpd.dsp  modules        README.cmake      support
Apache-apr2.dsw  BuildAll.dsp  config.layout   httpd.dep    INSTALL         libhttpd.mak  NOTICE         README.platforms  test
Apache.dsw       BuildBin.dsp  configure       httpd.dsp    InstallBin.dsp  LICENSE       NWGNUmakefile  ROADMAP           VERSIONING
apache_probes.d  buildconf     configure.in    httpd.mak    LAYOUT          Makefile.in   os             server

4、查看 README 和 INSTALL;
執(zhí)行./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
5、可能會有依賴的包未安裝,根據(jù)其提示安裝即可(一般為缺啥,安裝啥-devel);

[root@localhost httpd-2.4.43]# ./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.
[root@localhost httpd-2.4.43]# yum install apr-devel -y

重復(fù)第4,5步 直到成功安裝生成 Makefile 文件

成功
[root@localhost httpd-2.4.43]# make -j4
make
[root@localhost httpd-2.4.43]# make install
make install

6、啟動訪問;

[root@localhost httpd-2.4.43]# cd /apps/
httpd24/ nginx/
[root@localhost httpd-2.4.43]# cd /apps/httpd24/
[root@localhost httpd24]# ls
bin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules
[root@localhost httpd24]# cd bin
[root@localhost bin]# ls
ab         apxs      dbmmanage  envvars-std  htcacheclean  htdigest  httpd      logresolve
apachectl  checkgid  envvars    fcgistarter  htdbm         htpasswd  httxt2dbm  rotatelogs

[root@localhost bin]# ./apachectl
[root@localhost bin]# ps aux|grep http
root      22644  0.0  0.1  74932  2388 ?        Ss   14:57   0:00 /apps/httpd24/bin/httpd -k start
daemon    22645  0.0  0.2 429432  4216 ?        Sl   14:57   0:00 /apps/httpd24/bin/httpd -k start
daemon    22646  0.0  0.2 429432  4216 ?        Sl   14:57   0:00 /apps/httpd24/bin/httpd -k start
daemon    22647  0.0  0.2 429432  4216 ?        Sl   14:57   0:00 /apps/httpd24/bin/httpd -k start
root      22739  0.0  0.0 112824   980 pts/0    S+   14:58   0:00 grep --color=auto http
[root@localhost bin]# lsof -i:80
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   22644   root    4u  IPv6  39358      0t0  TCP *:http (LISTEN)
httpd   22645 daemon    4u  IPv6  39358      0t0  TCP *:http (LISTEN)
httpd   22646 daemon    4u  IPv6  39358      0t0  TCP *:http (LISTEN)
httpd   22647 daemon    4u  IPv6  39358      0t0  TCP *:http (LISTEN)
[root@localhost bin]# curl 192.168.1.111
<html><body><h1>It works!</h1></body></html>

訪問

三、創(chuàng)建一個2G的文件系統(tǒng),塊大小為2048byte,預(yù)留1%可用空間,文件系統(tǒng) ext4,卷標(biāo)為TEST,要求此分區(qū)開機(jī)后自動掛載至/test目錄,且默認(rèn)有acl掛載選項;

1、查看塊設(shè)備信息;

[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
sr0              11:0    1  918M  0 rom

以下將在sdb磁盤作為操作目標(biāo)
2、在sdb磁盤上創(chuàng)建大小為2G的分區(qū);

[root@localhost ~]# fdisk /dev/sdb
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xb6901c7c.

Command (m for help): n        #新建分區(qū)
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p        #創(chuàng)建主分區(qū)
Partition number (1-4, default 1):        #分區(qū)編號,默認(rèn)回車即可
First sector (2048-20971519, default 2048):        #分區(qū)大小,默認(rèn)回車即可
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +2G        #大小2G
Partition 1 of type Linux and of size 2 GiB is set

Command (m for help): w        #保存
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
└─sdb1            8:17   0    2G  0 part   ############創(chuàng)建的2G分區(qū)
sr0              11:0    1  918M  0 rom

3、在sdb1分區(qū)上創(chuàng)建文件系統(tǒng);

[root@localhost ~]# mkfs.ext4 -b 2048 -m 1 -L TEST /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=TEST
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 1048576 blocks
10485 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=269484032
64 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

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@localhost ~]# blkid
/dev/sda1: UUID="61bfe580-8947-41c1-91c0-0e3422e7d468" TYPE="xfs"
/dev/sda2: UUID="e2U6Yk-baaU-nYV4-UZxe-Uewf-etbD-yBNpQX" TYPE="LVM2_member"
/dev/sdb1: LABEL="TEST" UUID="e598b458-c2ba-4bbe-a2b7-7791be1278fb" TYPE="ext4"
/dev/sr0: UUID="2018-11-25-21-21-31-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/mapper/centos-root: UUID="a5cdc275-8211-41ab-b6b3-3dec286dd8b9" TYPE="xfs"
/dev/mapper/centos-swap: UUID="46e70da6-8858-46a4-a187-71b59a52b95b" TYPE="swap"

4、將分區(qū)掛載到指定文件夾;

[root@localhost ~]# vim /etc/fstab

----最后一行在命令行模式執(zhí)行 :r!blkid /dev/sdb1 然后回車


獲取UUID
獲取UUID

將粘貼的一行修改為:

UUID=e598b458-c2ba-4bbe-a2b7-7791be1278fb /test ext4 acl 0 0

5、創(chuàng)建目標(biāo)文件夾,并手動使配置文件生效;

[root@localhost ~]# mkdir /test
[root@localhost ~]# mount -a
[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
└─sdb1            8:17   0    2G  0 part /test
sr0              11:0    1  918M  0 rom
[root@localhost ~]# df -h /test
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       2.0G  9.1M  1.9G   1% /test

四、創(chuàng)建一個至少有兩個PV組成的大小為20G的名為testvg的VG;要求PE大小 為16MB, 而后在卷組中創(chuàng)建大小為5G的邏輯卷testlv;掛載至/users目錄;

1、查看硬盤信息;

[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
└─sdb1            8:17   0    2G  0 part /test
sdc               8:32   0   15G  0 disk
sdd               8:48   0   15G  0 disk
sr0              11:0    1  918M  0 rom

以下將使用整塊sdc和sdd各10G空間共同創(chuàng)建物理卷組
2、在sdc和sdd硬盤上各創(chuàng)建10G的分區(qū);

------sdc
[root@localhost ~]# fdisk /dev/sdc
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xddedf037.

Command (m for help): p

Disk /dev/sdc: 16.1 GB, 16106127360 bytes, 31457280 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: 0xddedf037

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-31457279, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-31457279, default 31457279): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): P

Disk /dev/sdc: 16.1 GB, 16106127360 bytes, 31457280 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: 0xddedf037

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    20973567    10485760   83  Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p

Disk /dev/sdc: 16.1 GB, 16106127360 bytes, 31457280 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: 0xddedf037

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    20973567    10485760   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
------sdd

[root@localhost ~]# fdisk /dev/sdd
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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xcf6c8040.

Command (m for help): p

Disk /dev/sdd: 16.1 GB, 16106127360 bytes, 31457280 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: 0xcf6c8040

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-31457279, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-31457279, default 31457279): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): T
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p

Disk /dev/sdd: 16.1 GB, 16106127360 bytes, 31457280 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: 0xcf6c8040

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1            2048    20973567    10485760   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

查詢硬盤信息:

[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
└─sdb1            8:17   0    2G  0 part /test
sdc               8:32   0   15G  0 disk
└─sdc1            8:33   0   10G  0 part
sdd               8:48   0   15G  0 disk
└─sdd1            8:49   0   10G  0 part
sr0              11:0    1  918M  0 rom

3、在sdc1和sdd1分區(qū)上分別創(chuàng)建物理卷(pv);

[root@localhost ~]# pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created.
[root@localhost ~]# pvcreate /dev/sdd1
  Physical volume "/dev/sdd1" successfully created.
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  centos lvm2 a--  <19.00g     0
  /dev/sdc1         lvm2 ---   10.00g 10.00g
  /dev/sdd1         lvm2 ---   10.00g 10.00g

4、創(chuàng)建物理卷組(vg)為testvg,并將以上的pv加入其中;

[root@localhost ~]# vgcreate -s 16M testvg /dev/sdc1 /dev/sdd1
  Volume group "testvg" successfully created
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <19.00g      0
  testvg   2   0   0 wz--n- <19.97g <19.97g

5、在testvgz中創(chuàng)建大小為5G的邏輯卷(lv)卷名testlv;

[root@localhost ~]# lvcreate -n testlv -L 5G testvg
  Logical volume "testlv" created.
[root@localhost ~]# lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   centos -wi-ao---- <17.00g
  swap   centos -wi-ao----   2.00g
  testlv testvg -wi-a-----   5.00g

[root@localhost ~]# lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                 8:0    0   20G  0 disk
├─sda1              8:1    0    1G  0 part /boot
└─sda2              8:2    0   19G  0 part
  ├─centos-root   253:0    0   17G  0 lvm  /
  └─centos-swap   253:1    0    2G  0 lvm  [SWAP]
sdb                 8:16   0   10G  0 disk
└─sdb1              8:17   0    2G  0 part /test
sdc                 8:32   0   15G  0 disk
└─sdc1              8:33   0   10G  0 part
  └─testvg-testlv 253:2    0    5G  0 lvm
sdd                 8:48   0   15G  0 disk
└─sdd1              8:49   0   10G  0 part
sr0                11:0    1  918M  0 rom

6、創(chuàng)建文件系統(tǒng);

[root@localhost ~]# mkfs.ext4 /dev/testvg/testlv
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=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: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@localhost ~]# blkid
/dev/sda1: UUID="61bfe580-8947-41c1-91c0-0e3422e7d468" TYPE="xfs"
/dev/sda2: UUID="e2U6Yk-baaU-nYV4-UZxe-Uewf-etbD-yBNpQX" TYPE="LVM2_member"
/dev/sdb1: LABEL="TEST" UUID="e598b458-c2ba-4bbe-a2b7-7791be1278fb" TYPE="ext4"
/dev/sdc1: UUID="pPMjyj-x14w-wfFk-Sfao-XslB-BJve-yXGBrU" TYPE="LVM2_member"
/dev/sdd1: UUID="e8Kn4u-wfah-2zF1-nIdL-izYf-lIWh-KvGjje" TYPE="LVM2_member"
/dev/sr0: UUID="2018-11-25-21-21-31-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/mapper/centos-root: UUID="a5cdc275-8211-41ab-b6b3-3dec286dd8b9" TYPE="xfs"
/dev/mapper/centos-swap: UUID="46e70da6-8858-46a4-a187-71b59a52b95b" TYPE="swap"
/dev/mapper/testvg-testlv: UUID="94464a8b-758d-474c-bf56-55b76c425b19" TYPE="ext4"

7、在/etc/fstab配置文件中添加以下內(nèi)容;
UUID=94464a8b-758d-474c-bf56-55b76c425b19 /users ext4 defaults 0 0


配置

8、創(chuàng)建目標(biāo)文件夾,并手動使配置文件生效;

[root@localhost ~]# mkdir /users
[root@localhost ~]# mount -a
[root@localhost ~]# lsblk
NAME              MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                 8:0    0   20G  0 disk
├─sda1              8:1    0    1G  0 part /boot
└─sda2              8:2    0   19G  0 part
  ├─centos-root   253:0    0   17G  0 lvm  /
  └─centos-swap   253:1    0    2G  0 lvm  [SWAP]
sdb                 8:16   0   10G  0 disk
└─sdb1              8:17   0    2G  0 part /test
sdc                 8:32   0   15G  0 disk
└─sdc1              8:33   0   10G  0 part
  └─testvg-testlv 253:2    0    5G  0 lvm  /users
sdd                 8:48   0   15G  0 disk
└─sdd1              8:49   0   10G  0 part
sr0                11:0    1  918M  0 rom
[root@localhost ~]# df -h /users
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/testvg-testlv  4.8G   20M  4.6G   1% /users

至此,邏輯卷testlv已經(jīng)可以正常使用了

[root@localhost ~]# cd /users
[root@localhost users]# echo "life is shit" >a.txt
[root@localhost users]# ll
total 20
-rw-r--r-- 1 root root    13 Jul 15 14:48 a.txt
drwx------ 2 root root 16384 Jul 15 14:35 lost+found
[root@localhost users]# cat a.txt
life is shit

測試:
生成一個1G的文件在/user目錄

[root@localhost users]# dd if=/dev/zero of=/users bs=1G count=1
dd: failed to open ‘/users’: Is a directory
[root@localhost users]# dd if=/dev/zero of=/users/b.txt bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 21.8943 s, 49.0 MB/s
[root@localhost users]# ll -h b.txt
-rw-r--r-- 1 root root 1.0G Jul 15 14:53 b.txt
[root@localhost users]# df -h /users
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/testvg-testlv  4.8G  1.1G  3.6G  23% /users

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容