dodo升级13
Postgresql 常用操作
dodo数据库升级步骤
dodo13全模块升级
Ubuntu挂载硬盘
dodo13 测试问题记录
自定义功能
注册系统服务
13新功能
13源码修改
z
重置 JetBrains 试用时间
runbot环境
odoo相关网站
dodo随手记录
odoo接口安全
dodo单点登录
单点登录说明
接口说明
单点登录时序图
odoo安全
odoo安全性政策
odoo安全披露政策
GPT
2023062901_dodo临时生成文件并下载
本文档使用 MrDoc 发布
-
+
home page
Ubuntu挂载硬盘
通常,磁盘添加完成后,需要重启一下计算机,内核会自动检测到这个新的设备。 但是,在生产环境中我们需要不重启而让内核检测到SCSI磁盘。 ``` sh root@ubuntu:/# ls /sys/class/scsi_host/ -- 查看主机总线号 host0 host1 host2 root@ubuntu:/# echo "- - -" > /sys/class/scsi_host/host0/scan -- 重新扫描SCSI总线来添加设备 root@ubuntu:/# echo "- - -" > /sys/class/scsi_host/host1/scan root@ubuntu:/# echo "- - -" > /sys/class/scsi_host/host2/scan ``` ``` sh root@ubuntu:/data# fdisk -l -- 查看硬盘分区信息 Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 999423 997376 487M 83 Linux /dev/vda2 1001470 41940991 40939522 19.5G 5 Extended /dev/vda5 1001472 41940991 40939520 19.5G 8e Linux LVM Disk /dev/vdb: 500 GiB, 536870912000 bytes, 1048576000 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 root@ubuntu:/data# fdisk /dev/vdb -- 使用fdisk工具对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. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xed191ac7. Command (m for help): m -- 列出fdisk的帮助信息 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/vdb: 500 GiB, 536870912000 bytes, 1048576000 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: dos Disk identifier: 0xed191ac7 Command (m for help): n -- 增加一个分区 Partition type -- 选择是建立主分区还是扩展分区 p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p -- 建立主分区 Partition number (1-4, default 1): -- 输入分区号 First sector (2048-1048575999, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-1048575999, default 1048575999): Created a new partition 1 of type 'Linux' and of size 500 GiB. Command (m for help): p Disk /dev/vdb: 500 GiB, 536870912000 bytes, 1048576000 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: dos Disk identifier: 0xed191ac7 Device Boot Start End Sectors Size Id Type /dev/vdb1 2048 1048575999 1048573952 500G 83 Linux Command (m for help): w -- 保存 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. root@ubuntu:/data# mkfs.ext4 /dev/vdb1 -- 格式化新建的分区 mke2fs 1.42.13 (17-May-2015) Creating filesystem with 131071744 4k blocks and 32768000 inodes Filesystem UUID: 2949eb1a-4ea4-4238-b27a-4d3142fc472c 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 Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done root@ubuntu:/data# mkdir /data --建立一个新的挂载目录 root@ubuntu:/data# mount /dev/vdb1 /data root@ubuntu:/data# df -h Filesystem Size Used Avail Use% Mounted on udev 3.9G 0 3.9G 0% /dev tmpfs 799M 8.8M 790M 2% /run /dev/mapper/ubuntu--vg-root 20G 1.8G 17G 10% / tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 472M 57M 392M 13% /boot tmpfs 100K 0 100K 0% /run/lxcfs/controllers tmpfs 799M 0 799M 0% /run/user/1000 /dev/vdb1 493G 70M 467G 1% /data -- 挂载成功 ``` ``` 到此为止,我们的新硬盘已经加载成功了,但是这里有一个问题,一旦我们重新启动系统,还需要用mount命令重新挂接才能访问新硬盘, 如果需要在系统启动时自动挂载,那么需要用vi配置/etc/fstab文件, 将/dev/vdb1 /data ext4 defaults 1 1 添加到/etc/fstab的最后,然后重新启动系统即可。 第一列为设备号或该设备的卷标 第二列为挂载点 第三列为文件系统 第四列为文件系统参数 第五列为是否可以用demp命令备份。0:不备份,1:备份,2:备份,但比1重要性小。设置了该参数后,Linux中使用dump命令备份系统的时候就可以备份相应设置的挂载点了。 第六列为是否在系统启动的时候,用fsck检验分区。因为有些挂载点是不需要检验的,比如:虚拟内存swap、/proc等。0:不检验,1:要检验,2要检验,但比1晚检验,一般根目录设置为1,其他设置为2就可以了。 解除挂载 umount /dev/sdb1 查看分区是ext3还是ext4系统 df -hT ```
幻翼
Feb. 21, 2022, 2:44 p.m.
转发文档
Collection documents
Last
Next
手机扫码
Copy link
手机扫一扫转发分享
Copy link
Markdown文件
share
link
type
password
Update password