文章目录
-
- [1. 理解硬件](#1. 理解硬件)
-
- [1.1 磁盘、服务器、机柜、机房](#1.1 磁盘、服务器、机柜、机房)
- [1.2 磁盘物理结构](#1.2 磁盘物理结构)
- [1.3 磁盘的存储结构](#1.3 磁盘的存储结构)
- [1.4 磁盘的逻辑结构](#1.4 磁盘的逻辑结构)
-
- [1.4.1 理解过程](#1.4.1 理解过程)
- [1.4.2 真实过程](#1.4.2 真实过程)
- [1.5 CHS && LBA地址](#1.5 CHS && LBA地址)
- [2. 引入文件系统](#2. 引入文件系统)
- [3. ext2 文件系统](#3. ext2 文件系统)
- [4. 软硬连接](#4. 软硬连接)

1. 理解硬件
1.1 磁盘、服务器、机柜、机房
- 机械磁盘是计算机中唯一的一个机械设备
- 磁盘 - - - 外设
- 慢
- 容量大,价格便宜

题外话:
- 关于机房
- 关于磁盘 - - - 磁铁

1.2 磁盘物理结构

1.3 磁盘的存储结构

扇区:是磁盘存储数据的基本单位,512字节,块设备

如何定位一个扇区呢?(这里的顺序不准确,后面纠正)
- 可以先定位磁头(header)
- 确定磁头要访问哪一个柱面(磁道)(cylinder)
- 定位一个扇区(sector)
- CHS地址定位
文件 = 内容+属性 都是数据,无非就是占据那几个扇区的问题!能定位一个扇区了,能不能定位多个扇区呢?
c
[gsm@VM-4-3-centos ~]$ sudo fdisk -l /dev/vda
[sudo] password for gsm:
Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x0009ac89
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 104857566 52427759+ 83 Linux
- 扇区是从磁盘读出和写入信息的最小单位,通常大小为 512 字节。
- 磁头(head)数:每个盘片一般有上下两面,分别对应1个磁头,共2个磁头
- 磁道(track)数:磁道是从盘片外圈往内圈编号0磁道,1磁道...,靠近主轴的同心圆用于停靠磁头,不存储数据
- 柱面(cylinder)数:磁道构成柱面,数量上等同于磁道个数
- 扇区(sector)数:每个磁道都被切分成很多扇形区域,每道的扇区数量相同
- 圆盘(platter)数:就是盘片的数量
- 磁盘容量=磁头数 × 磁道(柱面)数 × 每道扇区数 × 每扇区字节数
- 细节:传动臂上的磁头是共进退的(这点比较重要,后面会说明)
柱面(cylinder),磁头(head),扇区(sector),显然可以定位数据了,这就是数据定位(寻址)方式之一,CHS寻址方式。
CHS寻址
对早期的磁盘非常有效,知道用哪个磁头,读取哪个柱面上的第几扇区就可以读到数据了。但是CHS模式支持的硬盘容量有限,因为系统用8bit来存储磁头地址,用10bit来存储柱面地址,用6bit来存储扇区地址,而一个扇区共有512Byte,这样使用CHS寻址一块硬盘最大容量为256 * 1024 * 63 * 512B = 8064 MB(1MB = 1048576B)(若按1MB=1000000B来算就是8.4GB)
1.4 磁盘的逻辑结构
1.4.1 理解过程

1.4.2 真实过程


1.5 CHS && LBA地址

总结:

2. 引入文件系统
3. ext2 文件系统



c
[gsm@VM-4-3-centos lesson20]$ ls /dev/vda*
/dev/vda /dev/vda1
[gsm@VM-4-3-centos lesson20]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 989M 0 989M 0% /dev
tmpfs 1000M 24K 1000M 1% /dev/shm
tmpfs 1000M 644K 999M 1% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda1 50G 7.1G 40G 15% /
tmpfs 200M 0 200M 0% /run/user/0
tmpfs 200M 0 200M 0% /run/user/1001
[gsm@VM-4-3-centos lesson20]$ dd if=/dev/zero of=./disk.iso bs=1M count=5
5+0 records in
5+0 records out
5242880 bytes (5.2 MB) copied, 0.00456059 s, 1.1 GB/s
[gsm@VM-4-3-centos lesson20]$ ll
total 5120
-rw-rw-r-- 1 gsm gsm 5242880 Dec 10 22:13 disk.iso
[gsm@VM-4-3-centos lesson20]$ mkfs.ext4 disk.iso
mke2fs 1.42.9 (28-Dec-2013)
disk.iso is not a block special device.
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
1280 inodes, 5120 blocks
256 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=5242880
1 block group
8192 blocks per group, 8192 fragments per group
1280 inodes per group
Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
[gsm@VM-4-3-centos lesson20]$ sudo mkdir /mnt/myvda2
[sudo] password for gsm:
[gsm@VM-4-3-centos lesson20]$ ls /mnt/myvda2/ -ld
drwxr-xr-x 2 root root 4096 Dec 10 22:16 /mnt/myvda2/
[gsm@VM-4-3-centos lesson20]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 989M 0 989M 0% /dev
tmpfs 1000M 24K 1000M 1% /dev/shm
tmpfs 1000M 644K 999M 1% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda1 50G 7.1G 40G 15% /
tmpfs 200M 0 200M 0% /run/user/0
tmpfs 200M 0 200M 0% /run/user/1001
[gsm@VM-4-3-centos lesson20]$ sudo mount -t ext4 ./disk.iso /mnt/myvda2[gsm@VM-4-3-centos lesson20]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 989M 0 989M 0% /dev
tmpfs 1000M 24K 1000M 1% /dev/shm
tmpfs 1000M 644K 999M 1% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda1 50G 7.1G 40G 15% /
tmpfs 200M 0 200M 0% /run/user/0
tmpfs 200M 0 200M 0% /run/user/1001
/dev/loop0 3.9M 53K 3.5M 2% /mnt/myvda2
[gsm@VM-4-3-centos lesson20]$ cd /mnt/myvda2
[gsm@VM-4-3-centos myvda2]$ ls
lost+found
[gsm@VM-4-3-centos myvda2]$ pwd
/mnt/myvda2
[gsm@VM-4-3-centos myvda2]$ sudo mkdir dir
[gsm@VM-4-3-centos myvda2]$ sudo touch test.txt
[gsm@VM-4-3-centos myvda2]$ ls -al
total 18
drwxr-xr-x 4 root root 1024 Dec 10 22:19 .
drwxr-xr-x. 3 root root 4096 Dec 10 22:16 ..
drwxr-xr-x 2 root root 1024 Dec 10 22:19 dir
drwx------ 2 root root 12288 Dec 10 22:14 lost+found
-rw-r--r-- 1 root root 0 Dec 10 22:19 test.txt
[gsm@VM-4-3-centos myvda2]$ sudo umount /mnt/myvda2
umount: /mnt/myvda2: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[gsm@VM-4-3-centos myvda2]$ pwd
/mnt/myvda2
[gsm@VM-4-3-centos myvda2]$ cd /
[gsm@VM-4-3-centos /]$ sudo umount /mnt/myvda2
[gsm@VM-4-3-centos /]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 989M 0 989M 0% /dev
tmpfs 1000M 24K 1000M 1% /dev/shm
tmpfs 1000M 644K 999M 1% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda1 50G 7.1G 40G 15% /
tmpfs 200M 0 200M 0% /run/user/0
tmpfs 200M 0 200M 0% /run/user/1001
4. 软硬连接

c
[gsm@VM-4-3-centos lesson20]$ touch file.txt
[gsm@VM-4-3-centos lesson20]$ ll
total 0
-rw-rw-r-- 1 gsm gsm 0 Dec 11 13:14 file.txt
[gsm@VM-4-3-centos lesson20]$ ln -s file.txt file-soft.link
[gsm@VM-4-3-centos lesson20]$ ll
total 0
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 0 Dec 11 13:14 file.txt
[gsm@VM-4-3-centos lesson20]$ ls -li
total 0
1053198 lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
1053099 -rw-rw-r-- 1 gsm gsm 0 Dec 11 13:14 file.txt
[gsm@VM-4-3-centos lesson20]$ echo "helloworld" > file.txt
[gsm@VM-4-3-centos lesson20]$ cat file.txt
helloworld
[gsm@VM-4-3-centos lesson20]$ cat file-soft.link
helloworld
[gsm@VM-4-3-centos lesson20]$ ln file.txt file-hard.link
[gsm@VM-4-3-centos lesson20]$ ll
total 8
-rw-rw-r-- 2 gsm gsm 11 Dec 11 13:18 file-hard.link
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 2 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ ll -i
total 8
1053099 -rw-rw-r-- 2 gsm gsm 11 Dec 11 13:18 file-hard.link
1053198 lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
1053099 -rw-rw-r-- 2 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ rm file.txt
[gsm@VM-4-3-centos lesson20]$ ll -i
total 4
1053099 -rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file-hard.link
1053198 lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
[gsm@VM-4-3-centos lesson20]$ cat file-hard.link
helloworld
[gsm@VM-4-3-centos lesson20]$ mv file-hard.link file.txt
[gsm@VM-4-3-centos lesson20]$ ll
total 4
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ pwd
/home/gsm/linux/112/lesson20
c
[gsm@VM-4-3-centos lesson20]$ touch code.c
[gsm@VM-4-3-centos lesson20]$ ll
total 4
-rw-rw-r-- 1 gsm gsm 0 Dec 11 13:40 code.c
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ vim code.c
[gsm@VM-4-3-centos lesson20]$ cat code.c
#include <stdio.h>
int main()
{
printf("hello world!\n");
return 0;
}
[gsm@VM-4-3-centos lesson20]$ gcc code.c -o code.exe
[gsm@VM-4-3-centos lesson20]$ ll
total 20
-rw-rw-r-- 1 gsm gsm 80 Dec 11 13:42 code.c
-rwxrwxr-x 1 gsm gsm 8360 Dec 11 13:42 code.exe
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ ./code.exe
hello world!
[gsm@VM-4-3-centos lesson20]$ sudo ln -s /home/gsm/linux/112/lesson20/code.exe /usr/bin/code
[sudo] password for gsm:
[gsm@VM-4-3-centos lesson20]$ ll /usr/bin/code
lrwxrwxrwx 1 root root 37 Dec 11 13:48 /usr/bin/code -> /home/gsm/linux/112/lesson20/code.exe
[gsm@VM-4-3-centos lesson20]$ code
hello world!
[gsm@VM-4-3-centos lesson20]$ sudo unlink /usr/bin/code
[gsm@VM-4-3-centos lesson20]$ code
-bash: /usr/bin/code: No such file or directory
c
[gsm@VM-4-3-centos lesson20]$ ll
total 20
-rw-rw-r-- 1 gsm gsm 80 Dec 11 13:42 code.c
-rwxrwxr-x 1 gsm gsm 8360 Dec 11 13:42 code.exe
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ mkdir -p dir1/dir2/dir3/
[gsm@VM-4-3-centos lesson20]$ mv code.exe dir1/dir2/dir3
[gsm@VM-4-3-centos lesson20]$ tree
.
|-- code.c
|-- dir1
| `-- dir2
| `-- dir3
| `-- code.exe
|-- file-soft.link -> file.txt
`-- file.txt
3 directories, 4 files
[gsm@VM-4-3-centos lesson20]$ ./dir1/dir2/dir3/code.exe
hello world!
[gsm@VM-4-3-centos lesson20]$ ln -s ./dir1/dir2/dir3/code.exe code
[gsm@VM-4-3-centos lesson20]$ ll
total 12
lrwxrwxrwx 1 gsm gsm 25 Dec 11 14:10 code -> ./dir1/dir2/dir3/code.exe
-rw-rw-r-- 1 gsm gsm 80 Dec 11 13:42 code.c
drwxrwxr-x 3 gsm gsm 4096 Dec 11 14:10 dir1
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file.txt
[gsm@VM-4-3-centos lesson20]$ ./code
hello world!
c
[gsm@VM-4-3-centos lesson20]$ ls /usr/include/
aio.h gnu netash signal.h
aliases.h gnu-versions.h netatalk sound
alloca.h grp.h netax25 spawn.h
a.out.h gshadow.h netdb.h stab.h
argp.h gssapi neteconet stdc-predef.h
argz.h gssapi.h netinet stdint.h
ar.h gssrpc netipx stdio_ext.h
arpa iconv.h netiucv stdio.h
asm ieee754.h netpacket stdlib.h
asm-generic ifaddrs.h netrom string.h
assert.h inttypes.h netrose strings.h
bits ip6tables.h nfs sys
byteswap.h iptables nlist.h syscall.h
c++ iptables.h nl_types.h sysexits.h
com_err.h kadm5 nss.h syslog.h
complex.h kdb.h numacompat1.h systemd
cpio.h keyutils.h numa.h tar.h
cpufreq.h krad.h numaif.h termio.h
crypt.h krb5 obstack.h termios.h
ctype.h krb5.h openssl tgmath.h
db_185.h langinfo.h paths.h thread_db.h
db.h lastlog.h pcrecpparg.h time.h
dirent.h libdb pcrecpp.h ttyent.h
dlfcn.h libelf.h pcre.h uapi
drm libgen.h pcreposix.h uchar.h
dwarf.h libintl.h pcre_scanner.h ucm
elf.h libio.h pcre_stringpiece.h ucontext.h
elfutils libiptc poll.h ucp
endian.h libipulog printf.h ucs
envz.h libmnl profile.h uct
err.h libnl3 protocols ulimit.h
errno.h libudev.h pthread.h unistd.h
error.h limits.h pty.h ustat.h
et link.h pwd.h utime.h
execinfo.h linux python2.7 utmp.h
fcntl.h locale.h python3.6m utmpx.h
features.h lzma rdma valgrind
fenv.h lzma.h re_comp.h values.h
FlexLexer.h malloc.h regex.h verto.h
fmtmsg.h math.h regexp.h verto-module.h
fnmatch.h mcheck.h resolv.h video
fpu_control.h mellanox rpc wait.h
fstab.h memory.h rpcsvc wchar.h
fts.h mft sched.h wctype.h
ftw.h misc scsi wordexp.h
_G_config.h mntent.h search.h xen
gconv.h monetary.h selinux xlocale.h
gelf.h mqueue.h semaphore.h xtables.h
getopt.h mstflint sepol xtables-version.h
gio-unix-2.0 mtcr_ul setjmp.h zconf.h
glib-2.0 mtd sgtty.h zlib.h
glob.h net shadow.h
[gsm@VM-4-3-centos lesson20]$ ln -s /usr/include inc
[gsm@VM-4-3-centos lesson20]$ ll
total 12
lrwxrwxrwx 1 gsm gsm 25 Dec 11 14:10 code -> ./dir1/dir2/dir3/code.exe
-rw-rw-r-- 1 gsm gsm 80 Dec 11 13:42 code.c
drwxrwxr-x 3 gsm gsm 4096 Dec 11 14:10 dir1
lrwxrwxrwx 1 gsm gsm 8 Dec 11 13:16 file-soft.link -> file.txt
-rw-rw-r-- 1 gsm gsm 11 Dec 11 13:18 file.txt
lrwxrwxrwx 1 gsm gsm 12 Dec 11 14:13 inc -> /usr/include
[gsm@VM-4-3-centos lesson20]$ cd inc/
[gsm@VM-4-3-centos inc]$ pwd
/home/gsm/linux/112/lesson20/inc
[gsm@VM-4-3-centos inc]$ ls
aio.h gnu netash signal.h
aliases.h gnu-versions.h netatalk sound
alloca.h grp.h netax25 spawn.h
a.out.h gshadow.h netdb.h stab.h
argp.h gssapi neteconet stdc-predef.h
argz.h gssapi.h netinet stdint.h
ar.h gssrpc netipx stdio_ext.h
arpa iconv.h netiucv stdio.h
asm ieee754.h netpacket stdlib.h
asm-generic ifaddrs.h netrom string.h
assert.h inttypes.h netrose strings.h
bits ip6tables.h nfs sys
byteswap.h iptables nlist.h syscall.h
c++ iptables.h nl_types.h sysexits.h
com_err.h kadm5 nss.h syslog.h
complex.h kdb.h numacompat1.h systemd
cpio.h keyutils.h numa.h tar.h
cpufreq.h krad.h numaif.h termio.h
crypt.h krb5 obstack.h termios.h
ctype.h krb5.h openssl tgmath.h
db_185.h langinfo.h paths.h thread_db.h
db.h lastlog.h pcrecpparg.h time.h
dirent.h libdb pcrecpp.h ttyent.h
dlfcn.h libelf.h pcre.h uapi
drm libgen.h pcreposix.h uchar.h
dwarf.h libintl.h pcre_scanner.h ucm
elf.h libio.h pcre_stringpiece.h ucontext.h
elfutils libiptc poll.h ucp
endian.h libipulog printf.h ucs
envz.h libmnl profile.h uct
err.h libnl3 protocols ulimit.h
errno.h libudev.h pthread.h unistd.h
error.h limits.h pty.h ustat.h
et link.h pwd.h utime.h
execinfo.h linux python2.7 utmp.h
fcntl.h locale.h python3.6m utmpx.h
features.h lzma rdma valgrind
fenv.h lzma.h re_comp.h values.h
FlexLexer.h malloc.h regex.h verto.h
fmtmsg.h math.h regexp.h verto-module.h
fnmatch.h mcheck.h resolv.h video
fpu_control.h mellanox rpc wait.h
fstab.h memory.h rpcsvc wchar.h
fts.h mft sched.h wctype.h
ftw.h misc scsi wordexp.h
_G_config.h mntent.h search.h xen
gconv.h monetary.h selinux xlocale.h
gelf.h mqueue.h semaphore.h xtables.h
getopt.h mstflint sepol xtables-version.h
gio-unix-2.0 mtcr_ul setjmp.h zconf.h
glib-2.0 mtd sgtty.h zlib.h
glob.h net shadow.h
c
[gsm@VM-4-3-centos lesson20]$ mkdir empty
[gsm@VM-4-3-centos lesson20]$ touch file.txt
[gsm@VM-4-3-centos lesson20]$ ll -i
total 4
1053197 drwxrwxr-x 2 gsm gsm 4096 Dec 11 14:19 empty
1053099 -rw-rw-r-- 1 gsm gsm 0 Dec 11 14:19 file.txt
[gsm@VM-4-3-centos lesson20]$ cd empty/
[gsm@VM-4-3-centos empty]$ mkdir dir
[gsm@VM-4-3-centos empty]$ ll
total 4
drwxrwxr-x 2 gsm gsm 4096 Dec 11 14:22 dir
[gsm@VM-4-3-centos empty]$ cd ..
[gsm@VM-4-3-centos lesson20]$ ll -i
total 4
1053197 drwxrwxr-x 3 gsm gsm 4096 Dec 11 14:22 empty
1053099 -rw-rw-r-- 1 gsm gsm 0 Dec 11 14:19 file.txt
[gsm@VM-4-3-centos lesson20]$ cd empty/
[gsm@VM-4-3-centos empty]$ ls -lai
total 12
1053197 drwxrwxr-x 3 gsm gsm 4096 Dec 11 14:22 .
1053094 drwxrwxr-x 3 gsm gsm 4096 Dec 11 14:19 ..
1053198 drwxrwxr-x 2 gsm gsm 4096 Dec 11 14:22 dir
[gsm@VM-4-3-centos empty]$ ls -lia dir
total 8
1053198 drwxrwxr-x 2 gsm gsm 4096 Dec 11 14:22 .
1053197 drwxrwxr-x 3 gsm gsm 4096 Dec 11 14:22 ..
[gsm@VM-4-3-centos empty]$ ls -lid /
2 dr-xr-xr-x. 20 root root 4096 Dec 11 14:36 /
[gsm@VM-4-3-centos empty]$ ls -lid /.
2 dr-xr-xr-x. 20 root root 4096 Dec 11 14:37 /.
[gsm@VM-4-3-centos empty]$ ll /
total 76
lrwxrwxrwx. 1 root root 7 Mar 7 2019 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 Jul 8 2024 boot
drwxr-xr-x 2 root root 4096 Nov 5 2019 data
drwxr-xr-x 19 root root 3040 Dec 10 18:39 dev
drwxr-xr-x. 95 root root 12288 Oct 11 21:06 etc
drwxr-xr-x. 4 root root 4096 Oct 9 15:32 home
lrwxrwxrwx. 1 root root 7 Mar 7 2019 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Mar 7 2019 lib64 -> usr/lib64
drwx------. 2 root root 16384 Mar 7 2019 lost+found
drwxr-xr-x. 2 root root 4096 Apr 11 2018 media
drwxr-xr-x. 3 root root 4096 Dec 10 22:16 mnt
drwxr-xr-x. 4 root root 4096 Nov 12 2024 opt
dr-xr-xr-x 109 root root 0 Oct 5 15:16 proc
dr-xr-x---. 8 root root 4096 Oct 11 21:06 root
drwxr-xr-x 25 root root 920 Dec 1 17:09 run
lrwxrwxrwx. 1 root root 8 Mar 7 2019 sbin -> usr/sbin
drwxr-xrwt 2 root root 4096 Oct 9 22:18 share_112
drwxr-xr-x. 2 root root 4096 Apr 11 2018 srv
dr-xr-xr-x 13 root root 0 Oct 9 21:54 sys
drwxrwxrwt. 12 root root 4096 Dec 11 14:25 tmp
drwxr-xr-x. 14 root root 4096 Jan 8 2021 usr
drwxr-xr-x. 20 root root 4096 Jan 8 2021 var
c
[gsm@VM-4-3-centos dir]$ echo "this is 10TB data" > log.txt
[gsm@VM-4-3-centos dir]$ ll -i
total 4
1053205 -rw-rw-r-- 1 gsm gsm 18 Dec 11 14:41 log.txt
[gsm@VM-4-3-centos dir]$ cat log.txt
this is 10TB data
[gsm@VM-4-3-centos dir]$ ln log.txt /tmp/log.txt.backup
[gsm@VM-4-3-centos dir]$ ls /tmp/log.txt.backup -li
1053205 -rw-rw-r-- 2 gsm gsm 18 Dec 11 14:41 /tmp/log.txt.backup
[gsm@VM-4-3-centos dir]$ ll -i
total 4
1053205 -rw-rw-r-- 2 gsm gsm 18 Dec 11 14:41 log.txt
[gsm@VM-4-3-centos dir]$ rm log.txt
[gsm@VM-4-3-centos dir]$ ll
total 0
[gsm@VM-4-3-centos dir]$ ls /tmp/log.txt.backup -li
1053205 -rw-rw-r-- 1 gsm gsm 18 Dec 11 14:41 /tmp/log.txt.backup
[gsm@VM-4-3-centos dir]$ cat /tmp/log.txt.backup
this is 10TB data