'전체 글'에 해당되는 글 274건

  1. 2024.02.16 Debian LVM 설정
  2. 2024.02.16 LVM 파티션 복구
  3. 2023.11.23 Rocky linux 네트워크 카드 전송속도등 변경 1
  4. 2023.04.04 Rocky Linux 9.1 NGINX 설치

Debian LVM 설정

Linux 2024. 2. 16. 16:11 posted by CecilDeSK
반응형

복구된 시스템에 LVM 설정을 진행 

사용된 시스템은 intel 8400E P35 MB  Debian 12

Debian 12 bookworm

 

 

root@debian40:~# 

fdisk -l 로 하드디스크 상태 확인후 기존 파티션 제거 새롭게 lvm2 타입(8e) 추가하기

root@debian40:~# fdisk -l
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: TOSHIBA THNSNJ12
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: 0xd5bf5d42

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1  *       2048    999423    997376   487M 83 Linux
/dev/sda2       1001470 250068991 249067522 118.8G  5 Extended
/dev/sda5       1001472 250068991 249067520 118.8G 8e Linux LVM


Disk /dev/sde: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000AZLX-0
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: 0x811ba888

Device     Boot Start       End   Sectors   Size Id Type
/dev/sde1        2048 976773167 976771120 465.8G 8e Linux LVM


Disk /dev/sdd: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA DT01ACA1
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: 0xad11c254

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdd1        2048 1953525167 1953523120 931.5G 8e Linux LVM


Disk /dev/sdc: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000DM003-1CH1
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: 0xcc592ffb

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdc1        2048 1953525167 1953523120 931.5G 8e Linux LVM


Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: HGST HTS721010A9
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: 0xb1a76144

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


Disk /dev/mapper/debian40--vg-root: 117.79 GiB, 126475042816 bytes, 247021568 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/debian40--vg-swap_1: 976 MiB, 1023410176 bytes, 1998848 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



lvm 물리볼륨 추가 하기 

root@debian40:~# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
root@debian40:~# pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created.
root@debian40:~# pvcreate /dev/sdd1
  Physical volume "/dev/sdd1" successfully created.
root@debian40:~# pvcreate /dev/sde1
  Physical volume "/dev/sde1" successfully created.


vg 생성 하기

root@debian40:~# vgcreate rl /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
  Volume group "rl" successfully created


vg생성상태 확인하기 

root@debian40:~# vgdisplay
  --- Volume group ---
  VG Name               rl
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               3.18 TiB
  PE Size               4.00 MiB
  Total PE              834632
  Alloc PE / Size       0 / 0   
  Free  PE / Size       834632 / 3.18 TiB
  VG UUID               Wfjv3r-vdAm-Aw7a-fMge-TEr8-WhmG-ITfMNL
   
  --- Volume group ---
  VG Name               debian40-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               118.76 GiB
  PE Size               4.00 MiB
  Total PE              30403
  Alloc PE / Size       30398 / 118.74 GiB
  Free  PE / Size       5 / 20.00 MiB
  VG UUID               LtyjFF-dzUX-ZePT-XjGd-WZcW-7aRp-LL0npL



lvm 논리볼륨을 전체 다 사용하기 (중간 백업용도라 전체 사용)
lvcreate -l 100%FREE(빈공간전체) -n lvhome(논리볼륨이름) rl(생성된vg이름)

   
root@debian40:~# lvcreate -l 100%FREE -n lvhome rl
  Logical volume "lvhome" created.
root@debian40:~# mkfs.ext4 /dev/rl/lvhome
mke2fs 1.47.0 (5-Feb-2023)
Creating filesystem with 854663168 4k blocks and 213671936 inodes
Filesystem UUID: 289725be-2db9-4d5f-8feb-40a4b87c7ca9
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848, 512000000, 550731776, 644972544

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): 
done
Writing superblocks and filesystem accounting information:            
done





root@debian40:~# ls -la /
total 65
drwxr-xr-x  18 root root  4096 Feb 13 18:28 .
drwxr-xr-x  18 root root  4096 Feb 13 18:28 ..
lrwxrwxrwx   1 root root     7 Feb 13 18:28 bin -> usr/bin
drwxr-xr-x   4 root root  1024 Feb 14 13:40 boot
drwxr-xr-x  20 root root  3660 Feb 16 14:06 dev
drwxr-xr-x  67 root root  4096 Feb 16  2024 etc
drwxr-xr-x   3 root root  4096 Feb 14 10:09 home
lrwxrwxrwx   1 root root    30 Feb 13 18:28 initrd.img -> boot/initrd.img-6.1.0-18-amd64
lrwxrwxrwx   1 root root    30 Feb 13 18:28 initrd.img.old -> boot/initrd.img-6.1.0-18-amd64
lrwxrwxrwx   1 root root     7 Feb 13 18:28 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Feb 13 18:28 lib64 -> usr/lib64
drwx------   2 root root 16384 Feb 13 18:28 lost+found
drwxr-xr-x   3 root root  4096 Feb 13 18:28 media
drwxr-xr-x   2 root root  4096 Feb 13 18:28 mnt
drwxr-xr-x   2 root root  4096 Feb 13 18:28 opt
dr-xr-xr-x 165 root root     0 Feb 16  2024 proc
drwx------   3 root root  4096 Feb 14 23:32 root
drwxr-xr-x  18 root root   580 Feb 16 13:37 run
lrwxrwxrwx   1 root root     8 Feb 13 18:28 sbin -> usr/sbin
drwxr-xr-x   2 root root  4096 Feb 13 18:28 srv
dr-xr-xr-x  13 root root     0 Feb 16  2024 sys
drwxrwxrwt   9 root root  4096 Feb 16  2024 tmp
drwxr-xr-x  12 root root  4096 Feb 13 18:28 usr
drwxr-xr-x  12 root root  4096 Feb 14 10:08 var
lrwxrwxrwx   1 root root    27 Feb 13 18:28 vmlinuz -> boot/vmlinuz-6.1.0-18-amd64
lrwxrwxrwx   1 root root    27 Feb 13 18:28 vmlinuz.old -> boot/vmlinuz-6.1.0-18-amd64


마운트할 디렉토리 생성 /home/cecil/share
생성된논리볼륨을 디렉토리에 마운트 /dev/rl/lvhome  -> /home/cecil/share 

root@debian40:~# mkdir /home/cecil/share
root@debian40:~# mount /dev/rl/lvhome /home/cecil/share 
root@debian40:~# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               rl
  PV Size               931.51 GiB / not usable 4.71 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238466
  Free PE               0
  Allocated PE          238466
  PV UUID               NaUlF5-yDJS-WyHv-eoja-sZgt-PqEa-1dCYUe
   
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               rl
  PV Size               931.51 GiB / not usable 4.71 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238466
  Free PE               0
  Allocated PE          238466
  PV UUID               Jd4ibE-KLl3-0hhd-QEwo-yvFe-7zcF-wvW3IY
   
  --- Physical volume ---
  PV Name               /dev/sdd1
  VG Name               rl
  PV Size               931.51 GiB / not usable 4.71 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238466
  Free PE               0
  Allocated PE          238466
  PV UUID               qj5Fod-0GyW-sPp4-C4TP-X52Q-DtQf-0AR5gR
   
  --- Physical volume ---
  PV Name               /dev/sde1
  VG Name               rl
  PV Size               465.76 GiB / not usable 3.02 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              119234
  Free PE               0
  Allocated PE          119234
  PV UUID               oeEyVq-4Bvs-Zee5-HteA-xFzi-uu6i-wRxRXS
   
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               debian40-vg
  PV Size               118.76 GiB / not usable 3.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              30403
  Free PE               5
  Allocated PE          30398
  PV UUID               oqOTeU-V0Dn-P8CZ-kejY-ShlD-IbJo-bFJgyA
   
root@debian40:~# vgdisplay
  --- Volume group ---
  VG Name               rl
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               3.18 TiB
  PE Size               4.00 MiB
  Total PE              834632
  Alloc PE / Size       834632 / 3.18 TiB
  Free  PE / Size       0 / 0   
  VG UUID               Wfjv3r-vdAm-Aw7a-fMge-TEr8-WhmG-ITfMNL
   
  --- Volume group ---
  VG Name               debian40-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               118.76 GiB
  PE Size               4.00 MiB
  Total PE              30403
  Alloc PE / Size       30398 / 118.74 GiB
  Free  PE / Size       5 / 20.00 MiB
  VG UUID               LtyjFF-dzUX-ZePT-XjGd-WZcW-7aRp-LL0npL
   
root@debian40:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rl/lvhome
  LV Name                lvhome
  VG Name                rl
  LV UUID                APhfXH-cwaz-rPRA-UuQ6-rHFq-7rt1-6LrTd4
  LV Write Access        read/write
  LV Creation host, time debian40, 2024-02-16 14:06:52 +0900
  LV Status              available
  # open                 1
  LV Size                3.18 TiB
  Current LE             834632
  Segments               4
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2
   
  --- Logical volume ---
  LV Path                /dev/debian40-vg/root
  LV Name                root
  VG Name                debian40-vg
  LV UUID                4yXMPO-Zikk-ndAQ-943m-kXqV-Le22-GLu7a3
  LV Write Access        read/write
  LV Creation host, time debian40, 2024-02-13 18:28:00 +0900
  LV Status              available
  # open                 1
  LV Size                <117.79 GiB
  Current LE             30154
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/debian40-vg/swap_1
  LV Name                swap_1
  VG Name                debian40-vg
  LV UUID                VsaCsL-32Ho-SFXC-RNDl-KePm-BBC8-MMEQtD
  LV Write Access        read/write
  LV Creation host, time debian40, 2024-02-13 18:28:00 +0900
  LV Status              available
  # open                 2
  LV Size                976.00 MiB
  Current LE             244
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1


   
root@debian40:~# lvs
  LV     VG          Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   debian40-vg -wi-ao---- <117.79g                                                    
  swap_1 debian40-vg -wi-ao----  976.00m                                                    
  lvhome rl          -wi-ao----    3.18t                                                    


시스템시작시 자동 마운트하기 위해서 fstab에 등록
등록하기 위해 매핑상태를 확인  ls /dev/mapper
debian40--vg-root  debian40--vg-swap_1  rl-lvhome
debian40--vg-root  debian40--vg-swap_1 기존등록 
rl-lvhome  새롭게 등록할 내용

root@debian40:~# ls /dev/mapper
control  debian40--vg-root  debian40--vg-swap_1  rl-lvhome


root@debian40:~# vi /etc/fstab 
# /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).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/debian40--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=5a846316-9f22-437e-bebb-9c5a23e358fd /boot           ext2    defaults        0       2
/dev/mapper/debian40--vg-swap_1 none            swap    sw              0       0
/dev/mapper/rl-lvhome   /home/cecil/share       ext4    defaults        0       0
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
~                                                                                                                                   
"/etc/fstab" 15 lines, 824 bytes written


업데이트 하여주고  reboot  확인해보기..

root@debian40:~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.1.0-18-amd64
root@debian40:~# 
root@debian40:~# reboot
root@debian40:~#
반응형

LVM 파티션 복구

Linux 2024. 2. 16. 15:42 posted by CecilDeSK
반응형

구형 데스크탑을 사용해서 중간백업용으로 사용하던 Rocky Linux 가  보드 문제로 부팅이 불가해서 또다른 구형 메인보드를 이용해 이전 복구 하는 간단한 방법으로 복구시도.. 하드디스크가 손상된 것은 아니었기에 큰 문제 없이 복구진행

이전 대상인 메인보드가 구형에 특별한 eide장치를 사용하는 마벨장치가 부착되어 Rocky Linux등이 작동되지 않아 Debian으로 진행, Debian은 가볍고 특성을 잘 타지 않아 하드웨어 호환성에 문제가 있을때 사용하는데 이번에도 커널패닉이 발생되지 않아 Debian 12 버전으로 진행

Debian 12 bookworm

 

 

1. Debian install 후 하드디스크를 붙여 기존 LVM 상태 확인

   fdisk -l 로 하드디스크 연결 상태 확인

Debian 12 install fdisk

 

 

2. pvdisplay 물리볼륨 확인

Debian PVdisplay 물리적볼륨 확인

물리볼륨 Unknown  VG  rl  , PV UUID 검색되어 표시된다. 분실되거나 손실된 볼륨이 없을때는 간단한 작업으로 이름만 동일하지 않다면(동일하더라도 변경하면 ) 바로 추가 해서 마운트 가능

4개의 하드디스크가 검색되고 동일한 VG 이름 rl를 사용하고 있다.

 

VG 상태

 

3. pvscan 과 vgscan으로 pv vg상태확인 

pvscan vgscan 상태 확인

lvm2 타입의 메타데이터를 가지는 볼륨그룹 rl 검색되어 PV 링크는 깨졌으나 동일한 VG이름하에 있다.

 

4. 활성화 vgchange 

vgchange -a y /dev/rl  (/dev/rl 깨진부분이나 일부문제가 있을경우 --activationmode partial 옵션으로 진행

vgchage -a y /dev/rl --activationmode partiall

vgchage -a y /dev/rl --activationmode partiall

3개의 장치만 부분적으로 활성화됨 

 

5. 마운트

#mount -t xfs /dev/rl/home00 /mnt

마운트시 오류 발생하면 

 

파티션 복구 작업을 진행 

xfs 라면

#xfs_repair /dev/rl/home00



ext4 라면

#e2fsck -y /dev/rl/home00

 

 

반응형

Rocky linux 네트워크 카드 전송속도등 변경

Linux 2023. 11. 23. 14:24 posted by CecilDeSK
반응형

 

네트워크 카드가 지원하는 속도를 변경하기위해서는 ethtool을 사용

 

네트워크 카드 정보확인  

lspci -m | grep -i Ethernet

 

네트워크카드 정보확인
lspci -m &#124; grep -i Ethernet

 

 

패키지가 없다면 우선 설치 ;;; CentOS, RHEL, Fedora, Rocky ...
#yum install ethtool net-tools
;;; if  Ubuntu, Debian   then 
;;; # apt-get install ethtool net-tools

yum install ethtool net-tools

 

네트워크 카드 이름 확인

ifconfig

ifconfig

ifconfig 정보를 통해 enp3s0 이 네트워크 카드 이름 확인

 

현재 설정상태 확인

ethtool enp3s0 

ethtool enp3s0

전송속도: 10~1000

Duplex: half Full 지원  등 확인

 

설정변경은 옵션 -s (소문자) 사용

ethtool -s enp3s0 speed 1000 duplex full autoneg on
;;; ethtool -s [Network Interface Name] speed [10 | 100 | 1000] duplex [half | full] autoneg [on | off]

부팅시 설정값 적용 설정
# vi /etc/sysconfig/network
   ethtool -s enp3s0 speed 1000 duplex full autoneg on
   ;;; ethtool -s [Network Interface Name] speed [10 | 100 | 1000] duplex [half | full] autoneg [on | off]
반응형

'Linux' 카테고리의 다른 글

Debian LVM 설정  (0) 2024.02.16
LVM 파티션 복구  (0) 2024.02.16
Rocky Linux 9.1 NGINX 설치  (0) 2023.04.04
[Mysql] mysql_secure_installation으로 패스워드 설정이 어려울때  (0) 2021.05.10
[mysql]CentOS7에서 MariaDB/ MySQL 설치  (0) 2017.01.04

Rocky Linux 9.1 NGINX 설치

Linux 2023. 4. 4. 15:52 posted by CecilDeSK
반응형

Rocky 9.1 은 기본적으로 Redhat Enterprise Linux v9 Compatible

(-RHEL and derivatives: CentOS, Oracle Linux, Rocky Linux, AlmaLinux)

우선 Yum을 유지하고 성능을 높이기 위해서 yum-utils 설치
#yum install yum-utils


yum 외부저장소 추가

#vi /etc/yum.repos.d/nginx.repo


아래내용 추가후 저장 

[nginx-stable]
name=nginx stable repo
baseurl= http://nginx.org/packages/centos/$releasever/$basearch/ 
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl= http://nginx.org/packages/mainline/centos/$releasever/$basearch/ 
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

 

#yum-config-manager --enable nginx-mainline


nginx 설치

#yum install nginx



nginx 포트 설정 및 Doc root 설정

# vi /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}


                                      


방화벽 포트허용 (http : 80, https : 443)

#firewall-cmd --permanent --zone=public --add-service=http
#firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload



서비스 등록및 시작

#systemctl start nginx
#systemctl enable nginx
반응형