Rescan scsi disk linux

Linux: Rescan for new and changes of devices

Additionally , resize the filesystem to the maximum size. 2 steps necessary. Increase the partition and then the filesystem. Be sure your backup is up to date!
Delete (YES DELETE, you just edit the partition table. That is no problem if you do not call mkfs.ext4)the current partition and create a new with the maximum size. Get the old partition info by fdisk especially the start block of the partition.

root@debdev # fdisk -l Disk /dev/sdb: 214.7 GB, 214748364800 bytes 255 heads, 63 sectors/track, 26108 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1649ccd6 Device Boot Start End Blocks Id System /dev/sdb1 1 13054 104856223+ 83 Linux

Delete Partition 1 (command d) and create a new primary partition (command n) at the same start block(cylinder). In this example Block 1

root@debdev # umount /deb/sdb1 root@debdev # fdisk /dev/sdb Command (m for help): d Selected partition 1 Command (m for help): n Partition number (1-4): 1 First cylinder (1-26108, default 1): 1 Last cylinder: Command (m for help): p Disk /dev/sdb: 214.7 GB, 214748364800 bytes 255 heads, 63 sectors/track, 26108 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1649ccd6 Device Boot Start End Blocks Id System /dev/sdb1 1 26108 209712478+ 83 Linux Command (m for help): w The partition table has been altered! root@debdev # partx /dev/sdb

Or use growpart. This command grows partition 1 (if it is the last partition on the disk) to the maximum size

root@debdev # growpart /dev/sda 1

Check volume integrity and resize the filesystem.

root@debdev # e2fsck -f /dev/sdb1 root@debdev # resize2fs -p /dev/sdb1

Источник

Rescan scsi disk linux

NAME

rescan-scsi-bus.sh - rescan the SCSI bus.

SYNOPSIS

rescan-scsi-bus.sh [ -l ] [ -w ] [ -c ] [ -r ] [ host. ]

DESCRIPTION

rescan-scsi-bus.sh is a program that is used to rescan the SCSI bus using the SCSI add- single-device feature of the Linux SCSI layer.

OPTIONS

-l Activates scanning for LUNs 0 .. 7 (default: 0). -L NUM Activates scanning for LUNs 0 .. LUN (default: 0). --luns=LIST Scan only LUNs in LIST. -w Enables scanning for device IDs 0 .. 15 (default: 0 .. 7). --ids=LIST Scan only device IDs in LIST. -i, --issue-lip Issue a FibreChannel LIP reset (default: disabled). -r, --remove Enables removing of devices (default: disabled). --forceremove Remove and readd every device (dangerous). -c Enables scanning of channels 0 1 (default: 0). --channels=LIST Scan only channels in LIST. host, --hosts=LIST If host adapters are given, only these are scanned (default: all). --nooptscan Don't stop looking for LUNs if 0 is not found. --color Use coloured prefixes OLD/NEW/DEL. LIST is a comma separated list of single values and ranges (no spaces allowed), e.g. 0,2-3,8,10-15.

AUTHOR

AVAILABILITY

rescan-scsi-bus.sh is available from http://www.garloff.de/kurt/linux/scsidev/ March 1998 RESCAN-SCSI-BUS.SH(8)

© 2019 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.

Читайте также:  Домашний интернет билайн линукс

Источник

🐧 Как сканировать / обнаруживать новые LUN и SCSI-диски на Linux

Когда система Linux подключена к SAN (Storage Area Network), вам необходимо повторно просканировать службу iSCSI, чтобы обнаружить новые LUN.

Для этого вы должны предоставить группе хранения данных номер WWN хоста Linux и требуемый размер LUN.

После того, как группа хранения сопоставит LUN с заданным хостом Linux, они предоставят вам новые сведения о LUN.

LUN в терминах хранения называется последовательным шестнадцатеричным номером LUN.

Вам необходимо просканировать хост SCSI, чтобы найти новые LUN, назначенные группой хранения.

Это можно сделать двумя способами: сканировать каждое хост-устройство scsi или запустить скрипт rescan-scsi-bus.sh для обнаружения новых дисков.

После сканирования их можно будет найти в каталоге «/dev/disk/by-id».

# ll /dev/disk/by-id total 0 lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684b -> ../../sdah lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684c -> ../../sdw . . lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684d -> ../../sdjk lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e -> ../../sdaa lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f -> ../../sdh

Кроме того, вы можете найти их с помощью команды Multipath, если они уже настроены с Multipath.

Multipath в основном настраивается на сервере базы данных Oracle для повышения производительности.

# multipath -ll 60a98000486e542d4f5a2f47694d684b dm-37 NETAPP,LUN C-Mode size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw |-+- policy='round-robin 0' prio=50 status=active | |- 1:0:4:18 sdoe 128:416 active ready running | |- 0:0:4:18 sdpq 131:256 active ready running | |- 0:0:5:18 sdsr 135:496 active ready running | `- 1:0:5:18 sdsq 135:480 active ready running `-+- policy='round-robin 0' prio=10 status=enabled |- 1:0:1:18 sdfw 131:32 active ready running |- 1:0:0:18 sdci 69:96 active ready running |- 0:0:1:18 sdbz 68:208 active ready running |- 0:0:0:18 sds 65:32 active ready running |- 1:0:3:18 sdmd 69:336 active ready running |- 1:0:2:18 sdjj 8:464 active ready running |- 0:0:3:34 sdjt 65:368 active ready running `- 0:0:2:34 sdgi 131:224 active ready running

Эта процедура работает в системах на базе Red Hat 6.x, 7.x и 8.x (RHEL – Red Hat Enterprise Linux), таких как CentOS и Oracle Linux.

Читайте также:  Слияние файлов в linux

Метод 1: Как найти новые LUN и SCSI-диски в Linux с помощью файла класса «/ sys»

Файловая система sysfs – это псевдофайловая система, которая предоставляет интерфейс для структур данных ядра.

Файлы в sysfs предоставляют информацию об устройствах, модулях ядра, файловых системах и других компонентах ядра.

Файловая система sysfs обычно монтируется в «/sys».

Обычно она устанавливается системой автоматически.

Вы можете использовать команду echo для сканирования каждого хост-устройства scsi, как показано ниже.

# echo "- - -" > /sys/class/scsi_host/host[n]/scan

Когда вы запускаете указанную выше команду для повторного сканирования всего, три тире («- – -») относятся к параметру подстановочного знака.

# echo "c t l" > /sys/class/scsi_host/host[n]/scan
  • c – Канал на HBA
  • t – целевой идентификатор SCSI
  • l – LUN ID
  • n – номер HBA

Выполните приведенную ниже команду, чтобы найти все номера хост-шины в вашей системе.

# ls /sys/class/scsi_host host0 host1 host2

Как только вы получите номер хост-шины, выполните следующую команду, чтобы обнаружить новые диски.

# echo "- - -" > /sys/class/scsi_host/host0/scan # echo "- - -" > /sys/class/scsi_host/host1/scan # echo "- - -" > /sys/class/scsi_host/host2/scan

Кроме того, их можно просканировать с помощью «цикла for» с помощью одной команды.

# for host in ls /sys/class/scsi_host/;do echo "- - -" >/sys/class/scsi_host/$/scan; done

Вы можете проверить их с помощью команды ls, как упоминалось в начале статьи.

# ls /dev/disk/by-id | grep -i "serial-hex of LUN"

Метод 2: Как просканировать новые LUN и SCSI-диски в Linux с помощью скрипта

Убедитесь, что вы уже установили пакет «sg3_utils», чтобы использовать этот сценарий. В противном случае выполните следующую команду, чтобы установить его.

Для систем RHEL/CentOS 6/7 используйте команду yum для установки sg3_utils.

Для систем RHEL / CentOS 8 и Fedora используйте команду dnf для установки sg3_utils.

Источник

Rescan SCSI bus on Linux System

SCSI stands for Small Computer System Interface and is a set of standards for transferring data and connecting devices and computers. Sometimes you make changes to disk devices on your Linux box while online which is even more often nowadays using virtual machines. Sometimes you also add a new disk and do not want to restart your Linux system. Wether you need to add a new disk or increase an existing disk size of your virtual machine, the changes will not be instantly visible from the Linux operating system because you need to rescan SCSI bus on Linux to see the change. It is quite easy to rescan SCSI bus on Linux, you can do it with a simple one line command (depending on the number of SCSI devices you have connected).

Читайте также:  Установка программного обеспечения линукс

Rescan SCSI bus on Linux

Follow the steps described below and you will see the new size of your disk.

Rescan SCSI bus on Linux

Please note that the rescan SCSI bus on Linux does not interrupt operating system operation nor remove any of the disks. Rescanning SCSI bus on Linux with the below procedure will add/freshen devices but not remove them.

When Adding a New Disk

When adding a new disk to your Linux system you need to rescan SCSI host.

You can do this with the following command:

echo "- - -" > /sys/class/scsi_host/hostX/scan

..where X is the number of SCSI host to scan.

You probably have more than one SCSI host available so to make it right you should repeat the above command for each SCSI host available.

Below is a practical example on how to rescan SCSI bus on Linux and and see the newly added disk:

[root@node-1 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan [root@node-1 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan [root@node-1 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan

The “- – -” part is where you tell the SCSI host what exactly to rescan and the hyphens are wildcards which tell SCSI host to rescan all controllers, channels and LUNs.

When Increasing Existing Disk Size

If you changed the size of an existing disk you might notice that the operating system can not see the new disk size until you rescan SCSI bus on Linux operating system.

The easiest way i’ve found is to rescan the specific device with the following command:

echo "1" > /sys/class/block/sdX/device/rescan

..where X is the device you increased and want to rescan.

Below is a practical example on how to rescan SCSI bus on Linux and and see the newly added disk:

[root@node-1 ~]# echo "1" > /sys/class/block/sdb/device/rescan

The “1” is a flag which causes the SCSI host to rescan the “sdb” block device and therefore refresh the data about the disk size. Please note that i choose this command due to the human readable “sdb” naming which is really easy to remember.

Otherwise the command could also be triggered as follows:

[root@node-1 ~]# echo "1" > /sys/class/scsi_device/2:0:1:0/device/rescan

..but in the last case you should know which device you want to rescan by the SCSI bus ID.

Источник

Оцените статью
Adblock
detector