When extending a SAN LUN or adding new storage, Linux requires some convincing before recognizing disk changes occurred. The following commands, executed as root, are helpful when managing storage:
Command "echo 1 > /sys/block/sdb/device/rescan" is simple and straightforward. Directly instruct the block device, in the example 'sdb', to rescan for new partitions. Remember the hardware is path /sys/block/[...], not path /dev/[...] used when mounting filesystems. There are no man pages or options of course. If you used 'fdisk' to modify a partition table, always run this.
Command "partprobe" is included in Red Hat's parted package. It is part of the default install. Run it without options to re-read all partition tables for changes. If you used 'fdisk' to modify a partition table, always run this. This command is not as effective at forcing updates as directly instructing the block device to rescan, however it checks all devices.
Command "fdisk" is included in Red Hat's util-linux package. When given the '-l' option, it lists all block devices and their partitions. When a LVM physical volume uses a whole disk, the message "Disk /dev/sdb doesn't contain a valid partition table" will appear. Do not panic; this is expected.
Command "pvscan" is included in Red Hat's lvm2 package. It scans all supported LVM block devices in the system for physical volumes. The default Red Hat storage layout uses a separate EXT3 partition for /boot. This requires a LVM formatted MSDOS partition for the other root (/) and swap filesystems. Avoiding legacy MSDOS partitions is recommended whenever possible. When adding additional storage make the block device a separate RAID logical disk, SAN/SCSI LUN or virtual disk and initialize the entire block device (whole disk) as a LVM physical volume, skipping partitions entirely.
Once the Linux OS correctly recognizes the storage's new size, you can easily re-size LVM objects and ext filesystems (often w/o un-mounting).
# rescan-scsi-bus.shCommand "rescan-scsi-bus.sh" is included in Red Hat's sg3_utils package. It is not part of the default install, however I highly suggest adding it during post-install. There are no options and no man pages. Run it to rescan for SCSI LUN or Fiber Channel SAN HBA changes. This is not required if the block device is already recognized.
# echo 1 > /sys/block/sdb/device/rescan
# partprobe
# fdisk -l
# pvscan
Command "echo 1 > /sys/block/sdb/device/rescan" is simple and straightforward. Directly instruct the block device, in the example 'sdb', to rescan for new partitions. Remember the hardware is path /sys/block/[...], not path /dev/[...] used when mounting filesystems. There are no man pages or options of course. If you used 'fdisk' to modify a partition table, always run this.
Command "partprobe" is included in Red Hat's parted package. It is part of the default install. Run it without options to re-read all partition tables for changes. If you used 'fdisk' to modify a partition table, always run this. This command is not as effective at forcing updates as directly instructing the block device to rescan, however it checks all devices.
Command "fdisk" is included in Red Hat's util-linux package. When given the '-l' option, it lists all block devices and their partitions. When a LVM physical volume uses a whole disk, the message "Disk /dev/sdb doesn't contain a valid partition table" will appear. Do not panic; this is expected.
Command "pvscan" is included in Red Hat's lvm2 package. It scans all supported LVM block devices in the system for physical volumes. The default Red Hat storage layout uses a separate EXT3 partition for /boot. This requires a LVM formatted MSDOS partition for the other root (/) and swap filesystems. Avoiding legacy MSDOS partitions is recommended whenever possible. When adding additional storage make the block device a separate RAID logical disk, SAN/SCSI LUN or virtual disk and initialize the entire block device (whole disk) as a LVM physical volume, skipping partitions entirely.
Once the Linux OS correctly recognizes the storage's new size, you can easily re-size LVM objects and ext filesystems (often w/o un-mounting).
Comments