
急!100分!:Linux达人来,解答这道实验题,会虚拟机的优先!
公司有一台文件服务器,为了更好的规划和使用硬盘空间,公司拿出3块146G的SCSI硬盘来作为存储使用,你作为管理员应如何配置LVM,(前期设置空间为200GB,后续增加1...
公司有一台文件服务器,为了更好的规划和使用硬盘空间,公司拿出3块146G的SCSI硬盘来作为存储使用,你作为管理员应如何配置LVM,(前期设置空间为200GB,后续增加100GB)
回解答的同学最好请用红帽的LINUX4或LINUX5
回答格式如下(最好用history命令历史直接复制过来):
[root@localhost ~]fdisk -l
[root@localhost ~]pvcreate ???
[root@localhost ~]pvxcan
等等,做出来的,在追加100分!!! 展开
回解答的同学最好请用红帽的LINUX4或LINUX5
回答格式如下(最好用history命令历史直接复制过来):
[root@localhost ~]fdisk -l
[root@localhost ~]pvcreate ???
[root@localhost ~]pvxcan
等等,做出来的,在追加100分!!! 展开
4个回答
展开全部
-------------------------------------------------------------
实验环境:
虚拟机:VMWare WorkStation 7.1
操作系统:RHEL 5.3
原有硬盘20G,使用自动分区安装系统
后添加3块SCSI硬盘,现已经全部热插上
-------------------------------------------------------------
[root@as5u3 ~]# echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
[root@as5u3 ~]# echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi
[root@as5u3 ~]# echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
[root@as5u3 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
[root@as5u3 ~]# fdisk /dev/sdb
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 19059.
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-19059, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19059, default 19059):
Using default value 19059
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l
0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris
1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 82 Linux swap / So c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c7 Syrinx
5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data
6 FAT16 42 SFS 86 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
Hex code (type L to list codes): 83
Command (m for help): p
Disk /dev/sdb: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 19059 153091386 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
-------------------------------------------------------------------
/dev/sdc /dev/sdd分区方法一样,略
-------------------------------------------------------------------
[root@as5u3 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 19059 153091386 83 Linux
Disk /dev/sdc: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 19059 153091386 83 Linux
Disk /dev/sdd: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 19059 153091386 83 Linux
[root@as5u3 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
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 19.88 GB
PE Size 32.00 MB
Total PE 636
Alloc PE / Size 636 / 19.88 GB
Free PE / Size 0 / 0
VG UUID tl8AYK-pp5C-M3Px-mMIg-XsFn-AO5o-JQC43E
[root@as5u3 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 19.89 GB / not usable 19.49 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 636
Free PE 0
Allocated PE 636
PV UUID HIsTkc-6E16-9QYp-AFA9-MFNU-oxFs-HZxEs3
[root@as5u3 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@as5u3 ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
[root@as5u3 ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created
[root@as5u3 ~]# vgextend VolGroup00 /dev/sdb1 /dev/sdc1 /dev/sdd1
Volume group "VolGroup00" successfully extended
[root@as5u3 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 4
Act PV 4
VG Size 457.78 GB
PE Size 32.00 MB
Total PE 14649
Alloc PE / Size 636 / 19.88 GB
Free PE / Size 14013 / 437.91 GB
VG UUID tl8AYK-pp5C-M3Px-mMIg-XsFn-AO5o-JQC43E
[root@as5u3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
19G 2.3G 16G 14% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
----------------------------------------------------------------------
扩展为200G
-----------------------------------------------------------------------
[root@as5u3 ~]# lvextend -L 200GB /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 200.00 GB
Logical volume LogVol00 successfully resized
[root@as5u3 ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 52428800 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 52428800 blocks long.
[root@as5u3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
194G 2.3G 182G 2% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
----------------------------------------------------------------------
再加100G
-----------------------------------------------------------------------
[root@as5u3 ~]# lvextend -L +100GB /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 300.00 GB
Logical volume LogVol00 successfully resized
[root@as5u3 ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 78643200 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 78643200 blocks long.
[root@as5u3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
274G 2.3G 258G 1% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
实验环境:
虚拟机:VMWare WorkStation 7.1
操作系统:RHEL 5.3
原有硬盘20G,使用自动分区安装系统
后添加3块SCSI硬盘,现已经全部热插上
-------------------------------------------------------------
[root@as5u3 ~]# echo "scsi add-single-device 0 0 1 0" > /proc/scsi/scsi
[root@as5u3 ~]# echo "scsi add-single-device 0 0 2 0" > /proc/scsi/scsi
[root@as5u3 ~]# echo "scsi add-single-device 0 0 3 0" > /proc/scsi/scsi
[root@as5u3 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
[root@as5u3 ~]# fdisk /dev/sdb
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 19059.
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-19059, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19059, default 19059):
Using default value 19059
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l
0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris
1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 82 Linux swap / So c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c7 Syrinx
5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data
6 FAT16 42 SFS 86 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
Hex code (type L to list codes): 83
Command (m for help): p
Disk /dev/sdb: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 19059 153091386 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
-------------------------------------------------------------------
/dev/sdc /dev/sdd分区方法一样,略
-------------------------------------------------------------------
[root@as5u3 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 19059 153091386 83 Linux
Disk /dev/sdc: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 19059 153091386 83 Linux
Disk /dev/sdd: 156.7 GB, 156766306304 bytes
255 heads, 63 sectors/track, 19059 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 19059 153091386 83 Linux
[root@as5u3 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
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 19.88 GB
PE Size 32.00 MB
Total PE 636
Alloc PE / Size 636 / 19.88 GB
Free PE / Size 0 / 0
VG UUID tl8AYK-pp5C-M3Px-mMIg-XsFn-AO5o-JQC43E
[root@as5u3 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 19.89 GB / not usable 19.49 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 636
Free PE 0
Allocated PE 636
PV UUID HIsTkc-6E16-9QYp-AFA9-MFNU-oxFs-HZxEs3
[root@as5u3 ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@as5u3 ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
[root@as5u3 ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created
[root@as5u3 ~]# vgextend VolGroup00 /dev/sdb1 /dev/sdc1 /dev/sdd1
Volume group "VolGroup00" successfully extended
[root@as5u3 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 4
Act PV 4
VG Size 457.78 GB
PE Size 32.00 MB
Total PE 14649
Alloc PE / Size 636 / 19.88 GB
Free PE / Size 14013 / 437.91 GB
VG UUID tl8AYK-pp5C-M3Px-mMIg-XsFn-AO5o-JQC43E
[root@as5u3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
19G 2.3G 16G 14% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
----------------------------------------------------------------------
扩展为200G
-----------------------------------------------------------------------
[root@as5u3 ~]# lvextend -L 200GB /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 200.00 GB
Logical volume LogVol00 successfully resized
[root@as5u3 ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 52428800 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 52428800 blocks long.
[root@as5u3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
194G 2.3G 182G 2% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
----------------------------------------------------------------------
再加100G
-----------------------------------------------------------------------
[root@as5u3 ~]# lvextend -L +100GB /dev/VolGroup00/LogVol00
Extending logical volume LogVol00 to 300.00 GB
Logical volume LogVol00 successfully resized
[root@as5u3 ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 78643200 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 78643200 blocks long.
[root@as5u3 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
274G 2.3G 258G 1% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 252M 0 252M 0% /dev/shm
展开全部
fdisk -l
查看有什么新的硬盘分区,
然后mkfs.ext3 /dev/sdX(X代表系统识别的硬盘)
然后mount /dev/sdX /mnt 就是可以在/mnt 下操作了,
当然,你要是让系统一启动就识别的话,得在/etc/fstab里面添加相应的硬盘
查看有什么新的硬盘分区,
然后mkfs.ext3 /dev/sdX(X代表系统识别的硬盘)
然后mount /dev/sdX /mnt 就是可以在/mnt 下操作了,
当然,你要是让系统一启动就识别的话,得在/etc/fstab里面添加相应的硬盘
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
下载软件
安装即可用硬盘
安装即可用硬盘
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询