Skip to main content

Add a New Hard Disk Without Rebooting Guest



A rescan can be issued by typing the following command:
echo "- - -" > /sys/class/scsi_host/host#/scan
fdisk -l
tail -f /var/log/message


Replace host# with actual value such as host0. You can find scsi_host value using the following command:
# ls /sys/class/scsi_host
Output:

host0
Now type the following to send a rescan request:
echo "- - -" > /sys/class/scsi_host/host0/scan
fdisk -l
tail -f /var/log/message


How Do I Delete a Single Device Called /dev/sdc?

In addition to re-scanning the entire bus, a specific device can be added or existing device deleted using the following command:
# echo 1 > /sys/block/devName/device/delete
# echo 1 > /sys/block/sdc/device/delete

How Do I Add a Single Device Called /dev/sdc?

To add a single device explicitly, use the following syntax:
# echo "scsi add-single-device <H> <B> <T> <L>" > /proc/scsi/scsi
Where,
  • <H> : Host
  • <B> : Bus (Channel)
  • <T> : Target (Id)
  • <L> : LUN numbers
For e.g. add /dev/sdc with host # 0, bus # 0, target # 2, and LUN # 0, enter:
# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi
# fdisk -l
# cat /proc/scsi/scsi

Sample Outputs:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 02 Lun: 00
  Vendor: VMware,  Model: VMware Virtual S Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02

Step #3: Format a New Disk

Now, you can create partition using fdisk and format it using mkfs.ext3 command:
# fdisk /dev/sdc
# mkfs.ext3 /dev/sdc3

Step #4: Create a Mount Point And Update /etc/fstab

# mkdir /disk3
Open /etc/fstab file, enter:
# vi /etc/fstab
Append as follows:
/dev/sdc3               /disk3           ext3    defaults        1 2
Save and close the file.

Optional Task: Label the partition

You can label the partition using e2label. For example, if you want to label the new partition /backupDisk, enter
# e2label /dev/sdc1 /backupDisk

Comments

Popular posts from this blog

Veritas cluster Interview Questions-2

Please go through questions and answers. Let me know if you have any doubt by leaving comment. Adding and removing cluster node  Q-1 How to add a node in an existing cluster? Ans:    Adding a node into an existing cluster is a multi steps process. 1:       Set up the hardware Before adding a node to an existing cluster, node must be physically connected with the cluster.       1: Connect the VCS private Ethernet controllers       2: Connect the node to the shared storage 2:       Install the VCS software in the node           Install the VCS software and install the license. 3:       Configure LLT and GAB Create the LLT & GAB configuration files (/etc/llthosts, /etc/llttab and /etc/gabtab) in the new node and update the files on the existing node. 4:       Add the node to an existing cluster We have to perform below given tasks in any of the exi...

AUDIT.YML

 --- - name: Update auditd.conf and restart auditd service   hosts: all   become: yes   tasks:     - name: Ensure the line 'disk_full_action = halt' exists in auditd.conf       lineinfile:         path: /etc/audit/auditd.conf         regexp: '^disk_full_action'         line: 'disk_full_action = halt'         state: present       register: disk_full_action_changed     - name: Ensure the line 'disk_error_action = halt' exists in auditd.conf       lineinfile:         path: /etc/audit/auditd.conf         regexp: '^disk_error_action'         line: 'disk_error_action = halt'         state: prese...

Learning Git

git config --global user.name  Yoganandhan Ganesan git config --global user.email gyoganandhan@gmail.com touch one.txt git status git add one.txt To remove the file in git  ------------------------------ git rm --cached one.txt To view the modified file difference  ------------------------------------ git diff To get the log ------------------- git log  git log --oneline --- git ignore file create ------------------------ touch .gitignore create branch -------------- git branch branch_name to change the branch ------------------- git checkout branch_name git checkout master ---------------- delete branch --------------- git branch -d branch_name ---------- to remvoe last commit  ------------------- git checkout . git checkout XXXXXX return to master with perivous position ----------------------------- git checkout master ------------------------------- we do not want to come pack to master ------------------------------------- git reset --hard ID(XXXXXX) git che...