redhat9.1 配置网络 添加一块10G大小的磁盘

1、配置网络:为网卡添加一个本网段IPV4地址,192.168.x.123

2、配置yum本地仓库,并完成traceroute命令的安装

3、用至少两种方法查看sshd服务的进程号

4、添加一块10G大小的磁盘,将该磁盘分为两个主分区,大小为1G、2G。将剩余的空间全部划分为扩展分区。划分一个逻辑分区,大小为3G。(主分区文件系统类型为ext4,逻辑分区文件系统类型为xfs)

1.1、配置网络:为网卡添加一个本网段IPV4地址,192.168.x.123

2.配置yum本地仓库,并完成traceroute命令的安装

3用至少两种方法查看sshd服务的进程号

(1)静态ps -aux | grep ssh

(2) ps -ef | grep ssh

 (3)通过pgrep命令查看sshd服务的进程号

4.添加一块10G大小的磁盘,将该磁盘分为两个主分区,大小为1G、2G。将剩余的空间全部划分为扩展分区。划分一个逻辑分区,大小为3G。(主分区文件系统类型为ext4,逻辑分区文件系统类型为xfs)

[C:\~]$ ssh root@192.168.140.128

Connecting to 192.168.140.128:22...

Connection established.

To escape to local shell, press Ctrl+Alt+].

Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register

Create an account or view all your systems at https://red.ht/insights-dashboard

Last login: Tue Feb  7 20:25:29 2023

/usr/bin/xauth:  file /root/.Xauthority does not exist

[root@localhost ~]# lsblk

NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS

sda             8:0    0   10G  0 disk

sr0            11:0    1  8.4G  0 rom  

nvme0n1       259:0    0   20G  0 disk

├─nvme0n1p1   259:1    0    1G  0 part /boot

└─nvme0n1p2   259:2    0   19G  0 part

  ├─rhel-root 253:0    0   17G  0 lvm  /

  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]

[root@localhost ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.37.4).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

fdisk: cannot open /dev/sdb: No such file or directory

[root@localhost ~]# p

bash: p: command not found...

[root@localhost ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.37.4).

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 0x7dc9180e.

Command (m for help): p

Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors

Disk model: VMware Virtual S

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: 0x7dc9180e

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): 1

First sector (2048-20971519, default 2048):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): +1G

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

Command (m for help): n

Partition type

   p   primary (1 primary, 0 extended, 3 free)

   e   extended (container for logical partitions)

Select (default p): p

Partition number (2-4, default 2): 2

First sector (2099200-20971519, default 2099200):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-20971519, default 20971519): +2G

Created a new partition 2 of type 'Linux' and of size 2 GiB.

Command (m for help): n

Partition type

   p   primary (2 primary, 0 extended, 2 free)

   e   extended (container for logical partitions)

Select (default p): e

Partition number (3,4, default 3): 3

First sector (6293504-20971519, default 6293504):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (6293504-20971519, default 20971519):

Created a new partition 3 of type 'Extended' and of size 7 GiB.

Command (m for help): n

All space for primary partitions is in use.

Adding logical partition 5

First sector (6295552-20971519, default 6295552):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (6295552-20971519, default 20971519): +3G

Created a new partition 5 of type 'Linux' and of size 3 GiB.

Command (m for help): p

Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors

Disk model: VMware Virtual S

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: 0x7dc9180e

Device     Boot   Start      End  Sectors Size Id Type

/dev/sda1          2048  2099199  2097152   1G 83 Linux

/dev/sda2       2099200  6293503  4194304   2G 83 Linux

/dev/sda3       6293504 20971519 14678016   7G  5 Extended

/dev/sda5       6295552 12587007  6291456   3G 83 Linux

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]# mkfs.ext /dev/sda1

bash: mkfs.ext: command not found...

[root@localhost ~]# lsblk

NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS

sda             8:0    0   10G  0 disk

├─sda1          8:1    0    1G  0 part

├─sda2          8:2    0    2G  0 part

├─sda3          8:3    0    1K  0 part

└─sda5          8:5    0    3G  0 part

sr0            11:0    1  8.4G  0 rom  

nvme0n1       259:0    0   20G  0 disk

├─nvme0n1p1   259:1    0    1G  0 part /boot

└─nvme0n1p2   259:2    0   19G  0 part

  ├─rhel-root 253:0    0   17G  0 lvm  /

  └─rhel-swap 253:1    0    2G  0 lvm  [SWAP]

[root@localhost ~]# mkfs.ext4 /dev/sda1

mke2fs 1.46.5 (30-Dec-2021)

Creating filesystem with 262144 4k blocks and 65536 inodes

Filesystem UUID: 84835d08-f215-49e9-b597-97a9d5201238

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

Allocating group tables: done                            

Writing inode tables: done                            

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

[root@localhost ~]# partprobe

Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.

[root@localhost ~]# mkfs.ext4 /dev/sda1

mke2fs 1.46.5 (30-Dec-2021)

/dev/sda1 contains a ext4 file system

created on Fri Feb 17 02:30:24 2023

Proceed anyway? (y,N) y

Creating filesystem with 262144 4k blocks and 65536 inodes

Filesystem UUID: 4cd35227-4878-4dae-adef-89e5d01880c3

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

Allocating group tables: done                            

Writing inode tables: done                            

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

[root@localhost ~]# mkfs.ext4 /dev/sda2

mke2fs 1.46.5 (30-Dec-2021)

Creating filesystem with 524288 4k blocks and 131072 inodes

Filesystem UUID: a3239ef5-5195-412e-8df9-032c52265cf9

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            

Writing inode tables: done                            

Creating journal (16384 blocks): done

Writing superblocks and filesystem accounting information: done

[root@localhost ~]# mkfs.xfs /dev/sda5

meta-data=/dev/sda5              isize=512    agcount=4, agsize=196608 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=1, sparse=1, rmapbt=0

         =                       reflink=1    bigtime=1 inobtcount=1

data     =                       bsize=4096   blocks=786432, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@localhost ~]# blkid

/dev/sda1: UUID="4cd35227-4878-4dae-adef-89e5d01880c3" TYPE="ext4" PARTUUID="7dc9180e-01"

/dev/mapper/rhel-swap: UUID="152e3529-b2c9-4f88-bb2b-59df3d3db7ce" TYPE="swap"

/dev/nvme0n1p1: UUID="e8e03b49-7398-4178-8c6d-52a845fd8334" TYPE="xfs" PARTUUID="39775ae9-01"

/dev/nvme0n1p2: UUID="nRX2Fj-0t27-mUNq-zqsQ-z2aI-4mol-xDMRaX" TYPE="LVM2_member" PARTUUID="39775ae9-02"

/dev/sr0: UUID="2022-10-27-08-34-36-00" LABEL="RHEL-9-1-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="3854687c" PTTYPE="dos"

/dev/mapper/rhel-root: UUID="e45a94da-20aa-471d-97fe-a3f0b0559a6b" TYPE="xfs"

/dev/sda2: UUID="a3239ef5-5195-412e-8df9-032c52265cf9" TYPE="ext4" PARTUUID="7dc9180e-02"

/dev/sda5: UUID="50c0cfd6-b03a-4659-b40f-80ea66c322e3" TYPE="xfs" PARTUUID="7dc9180e-05"

/dev/sda3: 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值