ubuntu 实战 / LVM分区创建

版主: jvip_chen

回复
头像
jvip_chen
社区版主
社区版主
帖子: 202
注册时间: 2019年 1月 5日 13:36 星期六

ubuntu 实战 / LVM分区创建

帖子 jvip_chen »

LVM分区创建

  查看当前主机磁盘状态

lwk@qwfys ~ $ sudo fdisk -l
[sudo] password for lwk:
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 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
Disklabel type: gpt
Disk identifier: BB95C542-9D93-47DB-B5A1-1B97116AA0D6

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2050047 999424 488M Linux filesystem
/dev/sda3 2050048 234440703 232390656 110.8G Linux LVM


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xd49b374d

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953525167 1953523120 931.5G 83 Linux


Disk /dev/mapper/mint--vg-root: 103 GiB, 110519910400 bytes, 215859200 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 /dev/mapper/mint--vg-swap_1: 7.9 GiB, 8459911168 bytes, 16523264 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

  可以看到,当前主机有两个磁盘,分别是/dev/sda和/dev/sdb。其中, 磁盘/dev/sda有三个分区,分别是efi、 /、swap,磁盘分区表采用GPT类型,磁盘/dev/sdb有一个分区/dev/sdb1,磁盘分区表采用DOS分区类型。

  这里我们将磁盘/dev/sdb修改成GPT分区表,并在/dev/sdb磁盘上创建两个分区,大小依次是10G、15G。

lwk@qwfys ~ $ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m

Help:

DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag

Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition

Misc
m print this menu
u change display/entry units
x extra functionality (experts only)

Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file

Save & Exit
w write table to disk and exit
q quit without saving changes

Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table


Command (m for help): p
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xd49b374d

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1953525167 1953523120 931.5G 83 Linux

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): g
Created a new GPT disklabel (GUID: 5CE4A5A7-CABC-486E-9361-8860D0A1EEBD).

Command (m for help): n
Partition number (1-128, default 1): n
Value out of range.
Partition number (1-128, default 1):
First sector (2048-1953525134, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525134, default 1953525134):

Created a new partition 1 of type 'Linux filesystem' and of size 931.5 GiB.

Command (m for help): p
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5CE4A5A7-CABC-486E-9361-8860D0A1EEBD

Device Start End Sectors Size Type
/dev/sdb1 2048 1953525134 1953523087 931.5G Linux filesystem

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

  分区完成以后,我们来查看一下当前主机的磁盘状态,具体如下:

lwk@qwfys ~ $ sudo fdisk -l
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 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
Disklabel type: gpt
Disk identifier: BB95C542-9D93-47DB-B5A1-1B97116AA0D6

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2050047 999424 488M Linux filesystem
/dev/sda3 2050048 234440703 232390656 110.8G Linux LVM


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5CE4A5A7-CABC-486E-9361-8860D0A1EEBD

Device Start End Sectors Size Type
/dev/sdb1 2048 1953525134 1953523087 931.5G Linux filesystem


Disk /dev/mapper/mint--vg-root: 103 GiB, 110519910400 bytes, 215859200 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 /dev/mapper/mint--vg-swap_1: 7.9 GiB, 8459911168 bytes, 16523264 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

  这里我们可以看到,第二块磁盘分区表类型也变成了GPT的了。

  接下来我们基于磁盘/dev/sdb创建卷组vgdate。

lwk@qwfys ~ $ sudo vgcreate vgdate /dev/sdb1
Volume group "vgdate" successfully created

  接一下来,我们基于vgdate创建两个逻辑卷lv01、lv02:

lwk@qwfys ~ $ sudo lvcreate -L 500G -n lv01 vgdate
Logical volume "lv01" created.
lwk@qwfys ~ $ sudo lvcreate -n lv02 vgdate
Please specify either size or extents.
Run `lvcreate --help' for more information.
lwk@qwfys ~ $ sudo lvcreate -L 439G -n lv02 vgdate
Volume group "vgdate" has insufficient free space (110466 extents): 112384 required.
lwk@qwfys ~ $ sudo lvcreate -L 110466M -n lv02 vgdate
Rounding up size to full physical extent 107.88 GiB
Logical volume "lv02" created.

  接下来,我们格式化两个逻辑卷。

lwk@qwfys ~ $ sudo mkfs /dev/vgdate/lv01
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 131072000 4k blocks and 32768000 inodes
Filesystem UUID: a7dad36b-c7e7-49f9-9eab-1a220d02c203
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

lwk@qwfys ~ $ sudo mkfs /dev/vgdate/lv02
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 28279808 4k blocks and 7077888 inodes
Filesystem UUID: 927ab089-921b-4a7f-b570-15405ffee1bc
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

  这里我们格式化的时候没有指定分区类型,默认采用ext2分区类型。

lwk@qwfys ~ $ sudo df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.3G 0 7.3G 0% /dev
tmpfs 1.5G 9.3M 1.5G 1% /run
/dev/mapper/mint--vg-root 102G 16G 81G 16% /
tmpfs 7.4G 46M 7.3G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.4G 0 7.4G 0% /sys/fs/cgroup
/dev/sda2 473M 132M 318M 30% /boot
cgmfs 100K 0 100K 0% /run/cgmanager/fs
tmpfs 1.5G 32K 1.5G 1% /run/user/1000
lwk@qwfys ~ $ sudo fdisk -l
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 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
Disklabel type: gpt
Disk identifier: BB95C542-9D93-47DB-B5A1-1B97116AA0D6

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 2050047 999424 488M Linux filesystem
/dev/sda3 2050048 234440703 232390656 110.8G Linux LVM


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5CE4A5A7-CABC-486E-9361-8860D0A1EEBD

Device Start End Sectors Size Type
/dev/sdb1 2048 1953525134 1953523087 931.5G Linux filesystem


Disk /dev/mapper/mint--vg-root: 103 GiB, 110519910400 bytes, 215859200 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 /dev/mapper/mint--vg-swap_1: 7.9 GiB, 8459911168 bytes, 16523264 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 /dev/mapper/vgdate-lv01: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/vgdate-lv02: 107.9 GiB, 115834093568 bytes, 226238464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
  接下来,我们创建挂载点
lwk@qwfys ~ $ ll /
total 101
drwxr-xr-x 23 root root 4096 Jun 25 13:18 ./
drwxr-xr-x 23 root root 4096 Jun 25 13:18 ../
drwxr-xr-x 2 root root 4096 Jun 25 13:16 bin/
drwxr-xr-x 5 root root 1024 Jun 25 13:33 boot/
drwxr-xr-x 2 root root 4096 Jun 25 19:39 cdrom/
drwxr-xr-x 22 root root 4180 Jun 29 18:59 dev/
drwxr-xr-x 152 root root 12288 Jun 29 12:05 etc/
drwxr-xr-x 3 root root 4096 Jun 25 19:39 home/
lrwxrwxrwx 1 root root 33 Jun 25 13:18 initrd.img -> boot/initrd.img-4.13.0-45-generic
lrwxrwxrwx 1 root root 33 Jun 25 19:39 initrd.img.old -> boot/initrd.img-4.10.0-38-generic
drwxr-xr-x 25 root root 4096 Jun 25 13:15 lib/
drwxr-xr-x 2 root root 4096 Jun 25 13:15 lib64/
drwx------ 2 root root 16384 Jun 25 19:37 lost+found/
drwxr-xr-x 3 root root 4096 Jun 25 13:09 media/
drwxr-xr-x 2 root root 4096 Nov 24 2017 mnt/
drwxr-xr-x 2 root root 4096 Nov 24 2017 opt/
dr-xr-xr-x 225 root root 0 Jun 29 18:39 proc/
drwx------ 6 root root 4096 Jun 25 15:43 root/
drwxr-xr-x 31 root root 940 Jun 29 18:39 run/
drwxr-xr-x 2 root root 12288 Jun 26 10:49 sbin/
drwxr-xr-x 2 root root 4096 Nov 24 2017 srv/
dr-xr-xr-x 13 root root 0 Jun 29 18:39 sys/
drwxrwxrwt 13 root root 4096 Jun 29 18:50 tmp/
drwxr-xr-x 10 root root 4096 Nov 24 2017 usr/
drwxr-xr-x 12 root root 4096 Nov 24 2017 var/
lrwxrwxrwx 1 root root 30 Jun 25 13:18 vmlinuz -> boot/vmlinuz-4.13.0-45-generic
lrwxrwxrwx 1 root root 30 Jun 25 19:39 vmlinuz.old -> boot/vmlinuz-4.10.0-38-generic
lwk@qwfys ~ $ sudo mkdir -p /data
lwk@qwfys ~ $ sudo mount /dev/mapper/vgdate-lv0 /data/hangzhou
mount: mount point /data/hangzhou does not exist
lwk@qwfys ~ $ sudo mkdir -p /data/hangzhou
lwk@qwfys ~ $ sudo mount /dev/mapper/vgdate-lv0 /data/hangzhou
mount: special device /dev/mapper/vgdate-lv0 does not exist
lwk@qwfys ~ $ ll /dev/
total 4
drwxr-xr-x 22 root root 4180 Jun 29 18:59 ./
drwxr-xr-x 24 root root 4096 Jun 29 19:15 ../
crw------- 1 root root 10, 235 Jun 29 18:39 autofs
drwxr-xr-x 2 root root 400 Jun 29 18:59 block/
drwxr-xr-x 2 root root 80 Jun 29 18:39 bsg/
crw-rw---- 1 root disk 10, 234 Jun 29 18:39 btrfs-control
drwxr-xr-x 3 root root 60 Jun 29 18:39 bus/
drwxr-xr-x 2 root root 3820 Jun 29 18:39 char/
crw------- 1 root root 5, 1 Jun 29 18:39 console
lrwxrwxrwx 1 root root 11 Jun 29 18:39 core -> /proc/kcore
drwxr-xr-x 2 root root 60 Jun 29 18:39 cpu/
crw------- 1 root root 10, 59 Jun 29 18:39 cpu_dma_latency
crw------- 1 root root 10, 203 Jun 29 18:39 cuse
drwxr-xr-x 6 root root 120 Jun 29 18:39 disk/
brw-rw---- 1 root disk 253, 0 Jun 29 18:39 dm-0
brw-rw---- 1 root disk 253, 1 Jun 29 18:39 dm-1
brw-rw---- 1 root disk 253, 2 Jun 29 19:03 dm-2
brw-rw---- 1 root disk 253, 3 Jun 29 19:13 dm-3
drwxr-xr-x 2 root root 80 Jun 29 18:39 dri/
crw------- 1 root root 245, 0 Jun 29 18:39 drm_dp_aux0
crw------- 1 root root 10, 61 Jun 29 18:39 ecryptfs
crw-rw---- 1 root video 29, 0 Jun 29 18:39 fb0
lrwxrwxrwx 1 root root 13 Jun 29 18:39 fd -> /proc/self/fd/
crw-rw-rw- 1 root root 1, 7 Jun 29 18:39 full
crw-rw-rw- 1 root root 10, 229 Jun 29 18:39 fuse
crw------- 1 root root 246, 0 Jun 29 18:39 hidraw0
crw------- 1 root root 10, 228 Jun 29 18:39 hpet
drwxr-xr-x 2 root root 0 Jun 29 18:39 hugepages/
crw------- 1 root root 10, 183 Jun 29 18:39 hwrng
crw------- 1 root root 89, 0 Jun 29 18:39 i2c-0
crw------- 1 root root 89, 1 Jun 29 18:39 i2c-1
crw------- 1 root root 89, 2 Jun 29 18:39 i2c-2
crw------- 1 root root 89, 3 Jun 29 18:39 i2c-3
lrwxrwxrwx 1 root root 25 Jun 29 18:39 initctl -> /run/systemd/initctl/fifo|
drwxr-xr-x 4 root root 360 Jun 29 18:39 input/
crw-r--r-- 1 root root 1, 11 Jun 29 18:39 kmsg
crw-rw----+ 1 root root 10, 232 Jun 29 18:39 kvm
drwxr-xr-x 2 root root 60 Jun 29 18:39 lightnvm/
lrwxrwxrwx 1 root root 28 Jun 29 18:39 log -> /run/systemd/journal/dev-log=
brw-rw---- 1 root disk 7, 0 Jun 29 18:39 loop0
brw-rw---- 1 root disk 7, 1 Jun 29 18:39 loop1
brw-rw---- 1 root disk 7, 2 Jun 29 18:39 loop2
brw-rw---- 1 root disk 7, 3 Jun 29 18:39 loop3
brw-rw---- 1 root disk 7, 4 Jun 29 18:39 loop4
brw-rw---- 1 root disk 7, 5 Jun 29 18:39 loop5
brw-rw---- 1 root disk 7, 6 Jun 29 18:39 loop6
brw-rw---- 1 root disk 7, 7 Jun 29 18:39 loop7
crw-rw---- 1 root disk 10, 237 Jun 29 18:39 loop-control
drwxr-xr-x 2 root root 140 Jun 29 18:59 mapper/
crw------- 1 root root 10, 227 Jun 29 18:39 mcelog
crw------- 1 root root 243, 0 Jun 29 18:39 mei0
crw-r----- 1 root kmem 1, 1 Jun 29 18:39 mem
crw------- 1 root root 10, 56 Jun 29 18:39 memory_bandwidth
drwxr-xr-x 2 root root 80 Jun 29 18:39 mint-vg/
drwxrwxrwt 2 root root 40 Jun 29 18:39 mqueue/
drwxr-xr-x 2 root root 60 Jun 29 18:39 net/
crw------- 1 root root 10, 58 Jun 29 18:39 network_latency
crw------- 1 root root 10, 57 Jun 29 18:39 network_throughput
crw-rw-rw- 1 root root 1, 3 Jun 29 18:39 null
crw-r----- 1 root kmem 1, 4 Jun 29 18:39 port
crw------- 1 root root 108, 0 Jun 29 18:39 ppp
crw------- 1 root root 10, 1 Jun 29 18:39 psaux
crw-rw-rw- 1 root tty 5, 2 Jun 29 19:21 ptmx
drwxr-xr-x 2 root root 0 Jun 29 18:39 pts/
crw-rw-rw- 1 root root 1, 8 Jun 29 18:39 random
crw-rw-r--+ 1 root netdev 10, 62 Jun 29 18:39 rfkill
lrwxrwxrwx 1 root root 4 Jun 29 18:39 rtc -> rtc0
crw------- 1 root root 249, 0 Jun 29 18:39 rtc0
brw-rw---- 1 root disk 8, 0 Jun 29 18:39 sda
brw-rw---- 1 root disk 8, 1 Jun 29 18:39 sda1
brw-rw---- 1 root disk 8, 2 Jun 29 18:39 sda2
brw-rw---- 1 root disk 8, 3 Jun 29 18:39 sda3
brw-rw---- 1 root disk 8, 16 Jun 29 18:51 sdb
brw-rw---- 1 root disk 8, 17 Jun 29 18:59 sdb1
crw-rw---- 1 root disk 21, 0 Jun 29 18:39 sg0
crw-rw---- 1 root disk 21, 1 Jun 29 18:39 sg1
drwxrwxrwt 2 root root 160 Jun 29 19:21 shm/
crw------- 1 root root 10, 231 Jun 29 18:39 snapshot
drwxr-xr-x 3 root root 240 Jun 29 18:39 snd/
lrwxrwxrwx 1 root root 15 Jun 29 18:39 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jun 29 18:39 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jun 29 18:39 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty 5, 0 Jun 29 18:48 tty
crw--w---- 1 root tty 4, 0 Jun 29 18:39 tty0
crw--w---- 1 root tty 4, 1 Jun 29 18:39 tty1
crw--w---- 1 root tty 4, 10 Jun 29 18:39 tty10
crw--w---- 1 root tty 4, 11 Jun 29 18:39 tty11
crw--w---- 1 root tty 4, 12 Jun 29 18:39 tty12
crw--w---- 1 root tty 4, 13 Jun 29 18:39 tty13
crw--w---- 1 root tty 4, 14 Jun 29 18:39 tty14
crw--w---- 1 root tty 4, 15 Jun 29 18:39 tty15
crw--w---- 1 root tty 4, 16 Jun 29 18:39 tty16
crw--w---- 1 root tty 4, 17 Jun 29 18:39 tty17
crw--w---- 1 root tty 4, 18 Jun 29 18:39 tty18
crw--w---- 1 root tty 4, 19 Jun 29 18:39 tty19
crw--w---- 1 root tty 4, 2 Jun 29 18:39 tty2
crw--w---- 1 root tty 4, 20 Jun 29 18:39 tty20
crw--w---- 1 root tty 4, 21 Jun 29 18:39 tty21
crw--w---- 1 root tty 4, 22 Jun 29 18:39 tty22
crw--w---- 1 root tty 4, 23 Jun 29 18:39 tty23
crw--w---- 1 root tty 4, 24 Jun 29 18:39 tty24
crw--w---- 1 root tty 4, 25 Jun 29 18:39 tty25
crw--w---- 1 root tty 4, 26 Jun 29 18:39 tty26
crw--w---- 1 root tty 4, 27 Jun 29 18:39 tty27
crw--w---- 1 root tty 4, 28 Jun 29 18:39 tty28
crw--w---- 1 root tty 4, 29 Jun 29 18:39 tty29
crw--w---- 1 root tty 4, 3 Jun 29 18:39 tty3
crw--w---- 1 root tty 4, 30 Jun 29 18:39 tty30
crw--w---- 1 root tty 4, 31 Jun 29 18:39 tty31
crw--w---- 1 root tty 4, 32 Jun 29 18:39 tty32
crw--w---- 1 root tty 4, 33 Jun 29 18:39 tty33
crw--w---- 1 root tty 4, 34 Jun 29 18:39 tty34
crw--w---- 1 root tty 4, 35 Jun 29 18:39 tty35
crw--w---- 1 root tty 4, 36 Jun 29 18:39 tty36
crw--w---- 1 root tty 4, 37 Jun 29 18:39 tty37
crw--w---- 1 root tty 4, 38 Jun 29 18:39 tty38
crw--w---- 1 root tty 4, 39 Jun 29 18:39 tty39
crw--w---- 1 root tty 4, 4 Jun 29 18:39 tty4
crw--w---- 1 root tty 4, 40 Jun 29 18:39 tty40
crw--w---- 1 root tty 4, 41 Jun 29 18:39 tty41
crw--w---- 1 root tty 4, 42 Jun 29 18:39 tty42
crw--w---- 1 root tty 4, 43 Jun 29 18:39 tty43
crw--w---- 1 root tty 4, 44 Jun 29 18:39 tty44
crw--w---- 1 root tty 4, 45 Jun 29 18:39 tty45
crw--w---- 1 root tty 4, 46 Jun 29 18:39 tty46
crw--w---- 1 root tty 4, 47 Jun 29 18:39 tty47
crw--w---- 1 root tty 4, 48 Jun 29 18:39 tty48
crw--w---- 1 root tty 4, 49 Jun 29 18:39 tty49
crw--w---- 1 root tty 4, 5 Jun 29 18:39 tty5
crw--w---- 1 root tty 4, 50 Jun 29 18:39 tty50
crw--w---- 1 root tty 4, 51 Jun 29 18:39 tty51
crw--w---- 1 root tty 4, 52 Jun 29 18:39 tty52
crw--w---- 1 root tty 4, 53 Jun 29 18:39 tty53
crw--w---- 1 root tty 4, 54 Jun 29 18:39 tty54
crw--w---- 1 root tty 4, 55 Jun 29 18:39 tty55
crw--w---- 1 root tty 4, 56 Jun 29 18:39 tty56
crw--w---- 1 root tty 4, 57 Jun 29 18:39 tty57
crw--w---- 1 root tty 4, 58 Jun 29 18:39 tty58
crw--w---- 1 root tty 4, 59 Jun 29 18:39 tty59
crw--w---- 1 root tty 4, 6 Jun 29 18:39 tty6
crw--w---- 1 root tty 4, 60 Jun 29 18:39 tty60
crw--w---- 1 root tty 4, 61 Jun 29 18:39 tty61
crw--w---- 1 root tty 4, 62 Jun 29 18:39 tty62
crw--w---- 1 root tty 4, 63 Jun 29 18:39 tty63
crw--w---- 1 root tty 4, 7 Jun 29 18:39 tty7
crw--w---- 1 root tty 4, 8 Jun 29 18:39 tty8
crw--w---- 1 root tty 4, 9 Jun 29 18:39 tty9
crw------- 1 root root 5, 3 Jun 29 18:39 ttyprintk
crw-rw---- 1 root dialout 4, 64 Jun 29 18:39 ttyS0
crw-rw---- 1 root dialout 4, 65 Jun 29 18:39 ttyS1
crw-rw---- 1 root dialout 4, 74 Jun 29 18:39 ttyS10
crw-rw---- 1 root dialout 4, 75 Jun 29 18:39 ttyS11
crw-rw---- 1 root dialout 4, 76 Jun 29 18:39 ttyS12
crw-rw---- 1 root dialout 4, 77 Jun 29 18:39 ttyS13
crw-rw---- 1 root dialout 4, 78 Jun 29 18:39 ttyS14
crw-rw---- 1 root dialout 4, 79 Jun 29 18:39 ttyS15
crw-rw---- 1 root dialout 4, 80 Jun 29 18:39 ttyS16
crw-rw---- 1 root dialout 4, 81 Jun 29 18:39 ttyS17
crw-rw---- 1 root dialout 4, 82 Jun 29 18:39 ttyS18
crw-rw---- 1 root dialout 4, 83 Jun 29 18:39 ttyS19
crw-rw---- 1 root dialout 4, 66 Jun 29 18:39 ttyS2
crw-rw---- 1 root dialout 4, 84 Jun 29 18:39 ttyS20
crw-rw---- 1 root dialout 4, 85 Jun 29 18:39 ttyS21
crw-rw---- 1 root dialout 4, 86 Jun 29 18:39 ttyS22
crw-rw---- 1 root dialout 4, 87 Jun 29 18:39 ttyS23
crw-rw---- 1 root dialout 4, 88 Jun 29 18:39 ttyS24
crw-rw---- 1 root dialout 4, 89 Jun 29 18:39 ttyS25
crw-rw---- 1 root dialout 4, 90 Jun 29 18:39 ttyS26
crw-rw---- 1 root dialout 4, 91 Jun 29 18:39 ttyS27
crw-rw---- 1 root dialout 4, 92 Jun 29 18:39 ttyS28
crw-rw---- 1 root dialout 4, 93 Jun 29 18:39 ttyS29
crw-rw---- 1 root dialout 4, 67 Jun 29 18:39 ttyS3
crw-rw---- 1 root dialout 4, 94 Jun 29 18:39 ttyS30
crw-rw---- 1 root dialout 4, 95 Jun 29 18:39 ttyS31
crw-rw---- 1 root dialout 4, 68 Jun 29 18:39 ttyS4
crw-rw---- 1 root dialout 4, 69 Jun 29 18:39 ttyS5
crw-rw---- 1 root dialout 4, 70 Jun 29 18:39 ttyS6
crw-rw---- 1 root dialout 4, 71 Jun 29 18:39 ttyS7
crw-rw---- 1 root dialout 4, 72 Jun 29 18:39 ttyS8
crw-rw---- 1 root dialout 4, 73 Jun 29 18:39 ttyS9
crw------- 1 root root 10, 239 Jun 29 18:39 uhid
crw------- 1 root root 10, 223 Jun 29 18:39 uinput
crw-rw-rw- 1 root root 1, 9 Jun 29 18:39 urandom
crw------- 1 root root 10, 240 Jun 29 18:39 userio
crw------- 1 root root 10, 55 Jun 29 18:39 vboxdrv
crw-rw-rw- 1 root root 10, 54 Jun 29 18:39 vboxdrvu
crw------- 1 root root 10, 53 Jun 29 18:39 vboxnetctl
drwxr-x--- 3 root vboxusers 60 Jun 29 18:39 vboxusb/
crw-rw---- 1 root tty 7, 0 Jun 29 18:39 vcs
crw-rw---- 1 root tty 7, 1 Jun 29 18:39 vcs1
crw-rw---- 1 root tty 7, 2 Jun 29 18:39 vcs2
crw-rw---- 1 root tty 7, 3 Jun 29 18:39 vcs3
crw-rw---- 1 root tty 7, 4 Jun 29 18:39 vcs4
crw-rw---- 1 root tty 7, 5 Jun 29 18:39 vcs5
crw-rw---- 1 root tty 7, 6 Jun 29 18:39 vcs6
crw-rw---- 1 root tty 7, 128 Jun 29 18:39 vcsa
crw-rw---- 1 root tty 7, 129 Jun 29 18:39 vcsa1
crw-rw---- 1 root tty 7, 130 Jun 29 18:39 vcsa2
crw-rw---- 1 root tty 7, 131 Jun 29 18:39 vcsa3
crw-rw---- 1 root tty 7, 132 Jun 29 18:39 vcsa4
crw-rw---- 1 root tty 7, 133 Jun 29 18:39 vcsa5
crw-rw---- 1 root tty 7, 134 Jun 29 18:39 vcsa6
drwxr-xr-x 2 root root 60 Jun 29 18:39 vfio/
crw------- 1 root root 10, 63 Jun 29 18:39 vga_arbiter
drwxr-xr-x 2 root root 80 Jun 29 18:59 vgdate/
crw------- 1 root root 10, 137 Jun 29 18:39 vhci
crw------- 1 root root 10, 238 Jun 29 18:39 vhost-net
crw------- 1 root root 10, 241 Jun 29 18:39 vhost-vsock
crw-rw-rw- 1 root root 1, 5 Jun 29 18:39 zero
lwk@qwfys ~ $ ll /dev/ |grep vgdate
drwxr-xr-x 2 root root 80 Jun 29 18:59 vgdate/
lwk@qwfys ~ $ sudo mount /dev/vgdate-lv0 /data/hangzhou
mount: special device /dev/vgdate-lv0 does not exist
lwk@qwfys ~ $ ll /dev/vgdate/
total 0
drwxr-xr-x 2 root root 80 Jun 29 18:59 ./
drwxr-xr-x 22 root root 4180 Jun 29 18:59 ../
lrwxrwxrwx 1 root root 7 Jun 29 19:03 lv01 -> ../dm-2
lrwxrwxrwx 1 root root 7 Jun 29 19:13 lv02 -> ../dm-3
lwk@qwfys ~ $ ll /dev/vgdate/lv01
lrwxrwxrwx 1 root root 7 Jun 29 19:03 /dev/vgdate/lv01 -> ../dm-2
lwk@qwfys ~ $ sudo mount /dev/vgdate/lv01 /data/hangzhou
lwk@qwfys ~ $ sudo mkdir -p /data/ningbo
lwk@qwfys ~ $ sudo mount /dev/vgdate/lv02 /data/ningbo
lwk@qwfys ~ $ ll /data/
total 16
drwxr-xr-x 4 root root 4096 Jun 29 19:26 ./
drwxr-xr-x 24 root root 4096 Jun 29 19:15 ../
drwxr-xr-x 3 root root 4096 Jun 29 19:03 hangzhou/
drwxr-xr-x 3 root root 4096 Jun 29 19:12 ningbo/
lwk@qwfys ~ $ ll /data/hangzhou/
total 24
drwxr-xr-x 3 root root 4096 Jun 29 19:03 ./
drwxr-xr-x 4 root root 4096 Jun 29 19:26 ../
drwx------ 2 root root 16384 Jun 29 19:03 lost+found/
lwk@qwfys ~ $
  接下来,我们磁盘挂载信息追加到/etc/fstab中,这样,系统每次重启系统的时候都会自动挂载相应分区。
lwk@qwfys ~ $ sudo cat /etc/fstab
[sudo] password for lwk:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/mint--vg-root / ext4 errors=remount-ro 0 1
# /boot was on /dev/sdb2 during installation
UUID=1bb14af9-ff87-454e-becf-61ab761638fb /boot ext2 defaults 0 2
# /boot/efi was on /dev/sdb1 during installation
/dev/mapper/mint--vg-swap_1 none swap sw 0 0
/dev/vgdate/lv01 /data/hangzhou ext4 defaults 0 0
/dev/vgdate/lv02 /data/ningbo ext4 defaults 0 0

lwk@qwfys ~ $
lwk@qwfys ~ $ ll /data/
total 16
drwxr-xr-x 4 root root 4096 Jun 29 19:26 ./
drwxr-xr-x 24 root root 4096 Jun 29 19:15 ../
drwxr-xr-x 3 root root 4096 Jun 29 21:36 hangzhou/
drwxr-xr-x 3 root root 4096 Jun 29 21:37 ningbo/
lwk@qwfys ~ $ ll /data/hangzhou/
total 24
drwxr-xr-x 3 root root 4096 Jun 29 21:36 ./
drwxr-xr-x 4 root root 4096 Jun 29 19:26 ../
drwx------ 2 root root 16384 Jun 29 21:36 lost+found/
lwk@qwfys ~ $ ll /data/ningbo/
total 24
drwxr-xr-x 3 root root 4096 Jun 29 21:37 ./
drwxr-xr-x 4 root root 4096 Jun 29 19:26 ../
drwx------ 2 root root 16384 Jun 29 21:37 lost+found/
lwk@qwfys ~ $
JoshuaSox
帖子: 1
注册时间: 2021年 1月 20日 15:41 星期三

-

帖子 JoshuaSox »

As a side note- shouldnt /var/tmp/eaccelerator or similar be used instead?

Default settings AFAIK for Debian is to delete contents of /tmp, I guess Ubuntu does the same- /etc/default/rcS--> TMPTIME=0

Wouldnt loss of /tmp/eaccelerator affect eaccelerators functionality or it will recreate the directory?
回复