AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-273268

Yurij Goncharuk's questions

Martin Hope
Yurij Goncharuk
Asked: 2020-02-22 01:31:14 +0800 CST

dracut:仅使用指定的配置文件

  • 0

是否可以告诉dracut在创建initramfs/etc/dracut.conf.d/时不要使用配置文件?/usr/lib/dracut/dracut.conf.d

在为另一个系统创建initramfs之前,我将配置文件移动到临时目录,并在创建后将其放回。我在有关dracutman的页面中没有看到任何选项。也许我没有那么小心。

initramfs dracut
  • 1 个回答
  • 228 Views
Martin Hope
Yurij Goncharuk
Asked: 2019-05-31 09:48:22 +0800 CST

Docker exec bash 交互式小终端窗口

  • 0

假设我有bash以下列方式之一交互运行的容器:

  • docker run -it <image> /bin/bash.
  • docker start <stopped_container>然后docker attach <container>。

当我想要另一个交互式会话时,我执行下一个命令:docker exec -it <container> /bin/bash. 一切似乎都很好,但终端窗口很小:

在此处输入图像描述

如何将新的交互式bash终端会话扩展到所需的大小?

docker tty
  • 1 个回答
  • 906 Views
Martin Hope
Yurij Goncharuk
Asked: 2019-04-24 00:36:47 +0800 CST

在引导期间激活多路径上的 LVM 分区的正确方法

  • 0

我有成功配置 iSCSI 和多路径的 Debian 9:

# multipath -ll /dev/mapper/mpathb
mpathb (222c60001556480c6) dm-2 Promise,Vess R2600xi
size=10T features='1 retain_attached_hw_handler' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 12:0:0:0 sdc 8:32 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 13:0:0:0 sdd 8:48 active ready running

/dev/mapper/mpathb是 LVM 组的一部分vg-one-100:

# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/dm-2  vg-one-100 lvm2 a--  10,00t 3,77t
# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  vg-one-100   1  17   0 wz--n- 10,00t 3,77t

vg-one-100组包含几卷:

# lvs
  LV          VG         Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-one-0-1  vg-one-100 -wi-a----- 20,00g                                                    
  lv-one-1-0  vg-one-100 -wi-a-----  2,41g                                                    
  lv-one-10-0 vg-one-100 -wi------- 20,00g                                                    
  lv-one-11-0 vg-one-100 -wi------- 30,00g                                                    
  lv-one-12-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-13-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-14-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-15-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-16-0 vg-one-100 -wi-------  2,41g                                                    
  lv-one-17-0 vg-one-100 -wi------- 30,00g                                                    
  lv-one-18-0 vg-one-100 -wi------- 30,00g                                                    
  lv-one-23-0 vg-one-100 -wi------- 20,00g                                                    
  lv-one-31-0 vg-one-100 -wi------- 20,00g                                                    
  lv-one-8-0  vg-one-100 -wi------- 30,00g                                                    
  lv-one-9-0  vg-one-100 -wi------- 20,00g                                                    
  lvm_images  vg-one-100 -wi-a-----  5,00t                                                    
  lvm_system  vg-one-100 -wi-a-----  1,00t          

我的lvm.conf包括下一个过滤器:

# grep filter /etc/lvm/lvm.conf | grep -vE '^.*#'
    filter = ["a|/dev/dm-*|", "r|.*|"]
    global_filter = ["a|/dev/dm-*|", "r|.*|"]

lvmetad被禁用:

# grep use_lvmetad /etc/lvm/lvm.conf | grep -vE '^.*#'
    use_lvmetad = 0

如果lvmetad禁用,lvm2-activation-generator则将使用。

就我而言lvm2-activation-generator,生成了所有需要的单元文件并在引导期间执行它:

# ls -1 /var/run/systemd/generator/lvm2-activation*
/var/run/systemd/generator/lvm2-activation-early.service
/var/run/systemd/generator/lvm2-activation-net.service
/var/run/systemd/generator/lvm2-activation.service

# systemctl status lvm2-activation-early.service
● lvm2-activation-early.service - Activation of LVM2 logical volumes
   Loaded: loaded (/etc/lvm/lvm.conf; generated; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-03-28 17:20:48 MSK; 3 weeks 4 days ago
     Docs: man:lvm2-activation-generator(8)
 Main PID: 897 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Activation of LVM2 logical volumes...
systemd[1]: Started Activation of LVM2 logical volumes.
root@virt1:~# systemctl status lvm2-activation-net.service
● lvm2-activation-net.service - Activation of LVM2 logical volumes
   Loaded: loaded (/etc/lvm/lvm.conf; generated; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-03-28 17:21:24 MSK; 3 weeks 4 days ago
     Docs: man:lvm2-activation-generator(8)
 Main PID: 1537 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Activation of LVM2 logical volumes...
lvm[1537]:   4 logical volume(s) in volume group "vg-one-100" now active
systemd[1]: Started Activation of LVM2 logical volumes.
root@virt1:~# systemctl status lvm2-activation.service
● lvm2-activation.service - Activation of LVM2 logical volumes
   Loaded: loaded (/etc/lvm/lvm.conf; generated; vendor preset: enabled)
   Active: inactive (dead) since Thu 2019-03-28 17:20:48 MSK; 3 weeks 4 days ago
     Docs: man:lvm2-activation-generator(8)
 Main PID: 900 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Activation of LVM2 logical volumes...
systemd[1]: Started Activation of LVM2 logical volumes.

问题在于:我无法在引导期间自动激活所有 LVM 卷,因为在通过 iSCSI 而不是多路径设备(片段)lvm2-activator-net.service附加(登录)后激活卷:journalctl

. . .
kernel: sd 11:0:0:0: [sdc] 21474836480 512-byte logical blocks: (11.0 TB/10.0 TiB)
kernel: sd 10:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
kernel: sd 11:0:0:0: [sdc] Write Protect is off
kernel: sd 11:0:0:0: [sdc] Mode Sense: 97 00 10 08
kernel: sd 11:0:0:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
kernel: sd 10:0:0:0: [sdb] Attached SCSI disk
kernel: sd 11:0:0:0: [sdc] Attached SCSI disk
iscsiadm[1765]: Logging in to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.0.151,3260] (multiple)
iscsiadm[1765]: Logging in to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.1.151,3260] (multiple)
iscsiadm[1765]: Login to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.0.151,3260] successful.
iscsiadm[1765]: Login to [iface: default, target: iqn.2012-07.com.promise:alias.tgt0000.2000000155588d75, portal: 172.16.1.151,3260] successful.
systemd[1]: Started Login to default iSCSI targets.
systemd[1]: Starting Activation of LVM2 logical volumes...
systemd[1]: Starting Activation of LVM2 logical volumes...
multipathd[884]: sdb: add path (uevent)
systemd[1]: Started Activation of LVM2 logical volumes.
systemd[1]: Started Activation of LVM2 logical volumes.
systemd[1]: Reached target Remote File Systems (Pre).
systemd[1]: Mounting /var/lib/one/datastores/101...
systemd[1]: Mounting /var/lib/one/datastores/100...
multipathd[884]: mpathb: load table [0 21474836480 multipath 1 retain_attached_hw_handler 0 1 1 service-time 0 1 1 8:16 1]
multipathd[884]: mpathb: event checker started
multipathd[884]: sdb [8:16]: path added to devmap mpathb
multipathd[884]: sdc: add path (uevent)
multipathd[884]: mpathb: load table [0 21474836480 multipath 1 retain_attached_hw_handler 0 2 1 service-time 0 1 1 8:16 1 service-time 0 1 1 8:32 1]
. . .

启动条件lvm2-activation-net.service正确:

# grep After /var/run/systemd/generator/lvm2-activation-net.service 
After=lvm2-activation.service iscsi.service fcoe.service

如何all在引导期间正确激活逻辑卷?

debian lvm
  • 1 个回答
  • 3763 Views
Martin Hope
Yurij Goncharuk
Asked: 2018-11-10 07:26:16 +0800 CST

OpenNebula LVM 数据存储使用场景问题

  • 0

我已经尝试在测试环境中配置 OpenNebula,由两台主机组成:

  • 带有太阳石的星云(前置机)
  • 已配置 VG的 kvm-node-1主机

星云机包含以下内容:

root@nebula:/var/lib/one/datastores# onedatastore list
      ID NAME                SIZE AVAIL CLUSTERS     IMAGES TYPE DS      TM      STAT
       0 system                 - -     0                 0 sys  -       ssh     on  
       1 default            39.1G 70%   0                 4 img  fs      ssh     on  
       2 files              39.1G 70%   0                 0 fil  fs      ssh     on  
     100 images_shared      39.1G 70%   0                 2 img  fs      shared  on  
     104 lvm_system         39.1G 76%   0                 0 sys  -       fs_lvm  on  
     105 lvm_images         39.1G 70%   0                 1 img  fs      fs_lvm  on  
     106 lvm_system2        39.1G 76%   0                 0 sys  -       fs_lvm  on
root@nebula:/var/lib/one/datastores# ls /var/lib/one/datastores/
0  1  100  101  105  2
root@nebula:/var/lib/one/datastores# showmount -e
Export list for nebula:
/var/lib/one/datastores/105 192.168.122.0/24
/var/lib/one/datastores/100 192.168.122.0/24

kvm-node-1机器包含以下内容:

root@kvm-node-1:/var/lib/one/datastores# ls /var/lib/one/datastores/
0  100  104  105  106
root@kvm-node-1:/var/lib/one/datastores# mount|grep nfs
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
192.168.122.240:/var/lib/one/datastores/100 on /var/lib/one/datastores/100 type nfs4 (rw,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.74,local_lock=none,addr=192.168.122.240)
192.168.122.240:/var/lib/one/datastores/105 on /var/lib/one/datastores/105 type nfs4 (rw,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.74,local_lock=none,addr=192.168.122.240)
root@kvm-node-1:/var/lib/one/datastores# vgs
  VG       #PV #LV #SN Attr   VSize   VFree 
  vg-one-0   1   1   0 wz--n- <10,00g <9,98g

我可以通过 Sunstone 将带有映像的 VM 部署到虚拟机管理程序。此映像已成功启动。但由于错误,我无法终止 VM:

Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 Command execution failed (exit code: 5): /var/lib/one/remotes/tm/fs_lvm/delete nebula:/var/lib/one//datastores/0/29/disk.0 29 105
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG E 29 delete: Command "    set -x
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 DEV=$(readlink /var/lib/one/datastores/0/29/disk.0)
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 if [ -d "/var/lib/one/datastores/0/29/disk.0" ]; then
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 rm -rf "/var/lib/one/datastores/0/29/disk.0"
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 else
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 rm -f /var/lib/one/datastores/0/29/disk.0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 if [ -z "$DEV" ]; then
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 exit 0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 fi
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 if echo "$DEV" | grep "^/dev/" &>/dev/null; then
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 sudo lvremove -f $DEV
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 fi
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 fi" failed: ++ readlink /var/lib/one/datastores/0/29/disk.0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + DEV=/dev/vg-one-0/lv-one-29-0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + '[' -d /var/lib/one/datastores/0/29/disk.0 ']'
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + rm -f /var/lib/one/datastores/0/29/disk.0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + '[' -z /dev/vg-one-0/lv-one-29-0 ']'
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + echo /dev/vg-one-0/lv-one-29-0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + grep '^/dev/'
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 + sudo lvremove -f /dev/vg-one-0/lv-one-29-0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 Volume group "vg-one-0" not found
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG I 29 Cannot process volume group vg-one-0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: LOG E 29 Error deleting /var/lib/one/datastores/0/29/disk.0
Fri Nov  9 16:04:55 2018 [Z0][TM][D]: Message received: TRANSFER FAILURE 29 Error deleting /var/lib/one/datastores/0/29/disk.0

我应该如何使用 LVM 数据存储组织前端机器和管理程序机器之间的交换来解决这个问题?

kvm lvm
  • 1 个回答
  • 442 Views
Martin Hope
Yurij Goncharuk
Asked: 2018-05-25 07:09:32 +0800 CST

DEB:多包,在包构建过程中忽略某些文件的安装

  • 2

我已经覆盖了文件中dh_auto_install:的目标。debian/rule现在,我所有构建的组件都安装在debian/tmp.

我package.install为我的套装的每个包裹都做了准备,但我有这个问题:

包A应该包含scripts两个文件。

包B也应该包含scriptsdir 但没有两个将在 package 中的文件A。

当然可以在文件中的scriptsdir 中设置debian/B.install文件。但是scriptsdir 包含大量文件,并且放置每个文件都需要更多时间。

是否可以排除文件中的某些特定package.install文件?

deb
  • 1 个回答
  • 1417 Views
Martin Hope
Yurij Goncharuk
Asked: 2018-05-22 05:39:44 +0800 CST

BASH/DASH:将数组传递给函数的最佳方法是什么?

  • 3

我有这个数组:

PARAMETERS_OF_COMPONENTS[1]="component1"
PARAMETERS_OF_COMPONENTS[2]="component21 component22 component23"
PARAMETERS_OF_COMPONENTS[3]="component3"
PARAMETERS_OF_COMPONENTS[4]="component41 component42 component43"

我想将该数组传递给这个函数:

foo()
{
    local param1="$1"
    local param2="$2"
    local array_param="$3"
    . . .

    echo "${PARAMETERS_OF_COMPONENTS[@]}"
}

当我以这种方式传递数组时:

foo "$param1" "$param2" "${PARAMETER_OF_COMPONENTS[@]}"

然后函数只打印:

component1

另外,我已经尝试了几种其他方法来传递数组,但我仍然没有找到正确的解决方案。

如何正确传递数组以发挥作用?此外,解决方案必须与 Dash 兼容(至少没有 bashisms)。

UPD @Kusalananda 向我解释说 Dash 不支持数组。谢谢你的澄清。

我会问另一个。如何将许多参数传递给函数而不直接以方式传递$1,$2......并且不涉及全局变量?我有几个想法,但我想听听你的方法吗?

我的任务是将函数从一个文件移动到另一个文件,但该函数使用全局变量。我不想使用全局变量。那么如何以最正确的方式做到这一点呢?

bash shell-script
  • 1 个回答
  • 3731 Views
Martin Hope
Yurij Goncharuk
Asked: 2018-02-03 01:34:54 +0800 CST

从 BIOS/EFI 进行网络引导 (PXE)

  • 3

这两种加载模式有什么区别?

  1. 来自 BIOS 的 PXE。
  2. 来自 EFI 的 PXE。

我知道固件将控制权传递给存储在 NIC ROM 中的 NIC 程序。该程序通过 BOOTP 提供 IP 地址和至少一个加载程序的路径。此加载程序通过 TFTP 加载到 NIC 的 RAM 并开始执行。然后加载程序(syslinux、grub ...)通过 TFTP/HTTP/FTP 将内核和 initrd 加载到主机 RAM 中并将控制权传递给内核。

为什么我必须有两个不同的加载程序版本(BIOS 版本和 EFI 版本)?

bios uefi
  • 1 个回答
  • 1830 Views
Martin Hope
Yurij Goncharuk
Asked: 2018-01-31 03:30:37 +0800 CST

将 root 挂载为 overlayfs

  • 6

我一直在尝试将 root (/) 挂载为 overlayfs。

操作系统正在通过 NFS 引导到 RAM。我在 initrd 中添加了一个 premount 脚本,它创建了“work”、“upper”和“lower”目录。

在引导过程中,我将 NFS 的内容复制到“较低”目录。之后 Overlayfs 被挂载到 ${rootmnt} 中。

最后,初始化脚本 chroots 到 ${rootmnt} (接下来,从真正的根目录初始化等......)并且操作系统工作正常。

自然,我看不到“工作”和“上层”目录。我怎样才能做到这一点?我必须在 initrd 中更改什么?

linux nfs
  • 1 个回答
  • 4950 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve