不重新启动LINUX服务器添加新硬盘!

来源:互联网 发布:linux桌面版哪个好 编辑:程序博客网 时间:2024/05/17 23:07

物理连接磁盘:
[root@Linux117 ~]# fdisk /dev/sdbc

Unable to open /dev/sdbc
[root@Linux117 ~]# more /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02

[root@Linux117 proc]# cd scsi
[root@Linux117 scsi]# ls
device_info  mptspi  scsi  sg
[root@Linux117 scsi]# more device_info
'Aashima' 'IMAGERY 2400SP' 0x1
'CHINON' 'CD-ROM CDS-431' 0x1
'CHINON' 'CD-ROM CDS-535' 0x1
'DENON' 'DRD-25X' 0x1
'HITACHI' 'DK312C' 0x1
'HITACHI' 'DK314C' 0x1
'IBM' '2104-DU3' 0x1
'IBM' '2104-TU3' 0x1
'IMS' 'CDD521/10' 0x1
'MAXTOR' 'XT-3280' 0x1
'MAXTOR' 'XT-4380S' 0x1
'MAXTOR' 'MXT-1240S' 0x1
'MAXTOR' 'XT-4170S' 0x1
'MAXTOR' 'XT-8760S' 0x1
'MEDIAVIS' 'RENO CD-ROMX2A' 0x1
'MICROTEK' 'ScanMakerIII' 0x1
'NEC' 'CD-ROM DRIVE:841' 0x1
'PHILIPS' 'PCA80SC' 0x1
'RODIME' 'RO3000S' 0x1
'SUN' 'SENA' 0x1
'SANYO' 'CRD-250S' 0x1
'SEAGATE' 'ST157N' 0x1
'SEAGATE' 'ST296' 0x1
[root@Linux117 scsi]# ls
device_info  mptspi  scsi  sg
[root@Linux117 scsi]# more scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
 注:使用这个命令增加磁盘:
 echo "scsi add-single-device w x y z" > /proc/scsi/scsi

指定的参数值 w、x、y 和 z,如下所示:
w 是主机适配器标识,第一个适配器为零(0)
x 是主机适配器上的 SCSI 通道,第一个通道为零(0)
y 是设备的 SCSI 标识
z 是 LUN 号,第一个 LUN 为零(0)
注:可使用这个命令删除磁盘:echo "scsi remove-single-device w x y z" > /proc/scsi/scsi
[root@Linux117 scsi]# echo "scsi add-single-device 0 00 02 00"> /proc/scsi/scsi[root@Linux117 scsi]# more scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 02 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI SCSI revision: 02
[root@Linux117 scsi]# fdisk -l

Disk /dev/sda: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4699    37640295   8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  83  Linux

Disk /dev/sdc: 231.9 GB, 231928233984 bytes
255 heads, 63 sectors/track, 28197 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table
[root@Linux117 scsi]#
[root@Linux117 ~]# vi csdn.txt
[root@Linux117 ~]# fdisk -l

Disk /dev/sda: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4699    37640295   8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  83  Linux

Disk /dev/sdc: 231.9 GB, 231928233984 bytes
255 heads, 63 sectors/track, 28197 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table
[root@Linux117 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 28197.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-28197, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-28197, default 28197):
Using default value 28197

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@Linux117 ~]# fdisk -l

Disk /dev/sda: 38.6 GB, 38654705664 bytes
255 heads, 63 sectors/track, 4699 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4699    37640295   8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  83  Linux

Disk /dev/sdc: 231.9 GB, 231928233984 bytes
255 heads, 63 sectors/track, 28197 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       28197   226492371   83  Linux
[root@Linux117 ~]# mkf
mkfifo         mkfs           mkfs.cramfs    mkfs.msdos
mkfontdir      mkfs.acfs      mkfs.ext2      mkfs.vfat
mkfontscale    mkfs.acfs.bin  mkfs.ext3
[root@Linux117 ~]# mkfs -t ext3 /dev/sdc1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
28311552 inodes, 56623092 blocks
2831154 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
1728 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:

done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@Linux117 ~]#
[root@Linux117 ~]#
[root@Linux117 ~]# mkdir /mnt/sdc1
[root@Linux117 ~]# chmod 777 /mnt/sdc1
[root@Linux117 ~]# mount /dev/sdc1 /mnt/sdc1
[root@Linux117 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       28G   22G  4.3G  84% /
/dev/sda1              99M   16M   79M  17% /boot
tmpfs                 4.9G  1.4G  3.5G  29% /dev/shm
/dev/sdc1             213G  188M  202G   1% /mnt/sdc1


 

原创粉丝点击