前言
LFS需要在宿主计算机上挂新硬盘,然后再分区。
用vmware做实验,在vmware上挂虚拟硬盘,手册上没写。莫非大家都用真机玩?
在vmware官方的文档中,找到了挂硬盘的说明。
资料
https://www.vmware.com/support/ws5/doc/ws_disk_add_virtual.html
这文档说的内容用一句话来表达: 在虚拟机上右击选择设置菜单,然后添加新设备,选择硬盘即可。
VMware Workstation 5.0
Features | Documentation | Knowledge Base | Discussion Forums
previous Prev Contents Last Next next
Adding a New Virtual Disk to a Virtual Machine
Virtual disks are stored as files on the host computer or on a network file server. It does not matter whether the physical disk that holds the files is IDE or SCSI. A virtual IDE drive can be stored on an IDE drive or on a SCSI drive. So can a virtual SCSI drive.
Use the virtual machine settings editor (VM > Settings) to add a new virtual disk to your virtual machine. To add an existing virtual disk to the virtual machine, see Adding an Existing Virtual Disk to a Virtual Machine. The virtual machine must be powered off before you begin. If it is not, shut down the guest operating system normally, then click Power Off on the VMware Workstation toolbar.
Note: If you have a Windows NT 4.0 guest with a SCSI virtual disk, you cannot add both an additional SCSI disk and an IDE disk to the configuration.
1. Open the virtual machine settings editor (VM > Settings) and click Add. The Add Hardware Wizard guides you through the steps to create your virtual disk.
Link to w_newhdd_hdwtype.png
2. Click Hard Disk, then click Next.
3. Select Create a new virtual disk, then click Next.
4. Choose whether you want the virtual disk to be an IDE disk or a SCSI disk.
5. Set the capacity for the new virtual disk.
If you wish, select Allocate all disk space now.
Allocating all the space at the time you create the virtual disk gives somewhat better performance, but it requires as much disk space as the size you specify for the virtual disk.
If you do not select this option, the virtual disk's files start small and grow as needed, but they can never grow larger than the size you set here.
You can set a size between 0.1GB and 950GB for a virtual disk. The default is 4GB.
You may also specify whether you want the virtual disk created as one large file or split into a set of 2GB files. You should split your virtual disk if it is stored on a file system that does not support files larger than 2GB.
6. Accept the default filename and location for the virtual disk file or change it, if you want to use a different name or location. To find a different folder, click Browse.
If you want to specify a device node for your virtual disk, click Advanced.
On the advanced settings screen, you can also specify a disk mode. This is useful in certain special-purpose configurations in which you want to exclude disks from snapshots. For more information on the snapshot feature, see Using Snapshots.
Normal disks are included in snapshots. In most cases, this is the setting you want — with Independent deselected.
Independent disks are not included in snapshots. If you select Independent, you have the following options:
Persistent — changes are immediately and permanently written to the disk.
Nonpersistent — changes to the disk are discarded when you power off or revert to a snapshot.
When you have set the filename and location you want to use and have made any selections you want to make on the advanced settings screen, click Finish.
7. The wizard creates the new virtual disk. It appears to your guest operating system as a new, blank hard disk. Use the guest operating system's tools to partition and format the new drive for use.
Adding an Existing Virtual Disk to a Virtual Machine
You can reconnect an existing virtual disk that has been removed from a virtual machine (see Removing a Virtual Disk from a Virtual Machine). The virtual machine must be powered off before you begin.
1. Open the virtual machine settings editor (VM > Settings) and click Add. The Add Hardware Wizard guides you through the steps to create your virtual disk.
2. Click Hard Disk, then click Next.
3. Select Use an existing virtual disk, then click Next.
4. Enter the path and filename for the existing disk file, or click Browse to navigate to the file.
5. Click OK.
Removing a Virtual Disk from a Virtual Machine
Use the virtual machine settings editor to disconnect a virtual disk from a virtual machine.
To remove a virtual disk from a virtual machine:
1. Select a virtual machine and choose VM > Settings.
Note: A virtual machine must be powered off before you can remove a virtual disk. You cannot remove a virtual disk if the virtual machine is suspended.
2. Select the virtual disk you want to remove.
3. Click Remove.
The virtual disk is disconnected from virtual machine.
Note: The Remove command does not delete files from the host file system. You can delete virtual disk files manually. You can also retain the virtual disk files and reconnect the virtual disk to the virtual machine later. See Adding an Existing Virtual Disk to a Virtual Machine.
previous Prev Contents Last Next next
识别增加的硬盘
加了硬盘之后,一时分辨不清哪块硬盘是新加的.
用fdisk -l 和 cfdisk /dev/sdx 解决了
// 虚拟机环境: vmware14 + centos6.9_minimal_64bits
* 在虚拟机关机情况下,添加虚拟硬盘,因为主硬盘是20GB, 为了防止分不清加入的新硬盘,新硬盘加了2块(20GB, 30GB)
* 查看分区信息, 看到3块硬盘 : Disk /dev/sda, Disk /dev/sdb, Disk /dev/sdc
这时还分不清哪块硬盘是新加的
[root@localhost /]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x000bfc14
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x00000000
Disk /dev/sdc: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x00000000
Disk /dev/mapper/VolGroup-lv_root: 18.8 GB, 18798870528 bytes
255 heads, 63 sectors/track, 2285 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: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 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: 0x00000000
* 用cfdisk每个硬盘, 看哪块硬盘是新加的
可以看出/dev/sdb, /dev/sdc 是新加的20GB和30GB硬盘
cfdisk /dev/sda
cfdisk (util-linux-ng 2.17.2)
Disk Drive: /dev/sda
Size: 21474836480 bytes, 21.4 GB
Heads: 255 Sectors per Track: 63 Cylinders: 2610
Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Pri/Log Free Space 1.05 *
sda1 Boot Primary Linux ext3 524.29 *
sda2 Primary Linux LVM 20949.50 *
cfdisk /dev/sdb
cfdisk (util-linux-ng 2.17.2)
Disk Drive: /dev/sdb
Size: 21474836480 bytes, 21.4 GB
Heads: 255 Sectors per Track: 63 Cylinders: 2610
Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Pri/Log Free Space 21474.84 *
cfdisk /dev/sdc
cfdisk (util-linux-ng 2.17.2)
Disk Drive: /dev/sdc
Size: 32212254720 bytes, 32.2 GB
Heads: 255 Sectors per Track: 63 Cylinders: 3916
Name Flags Part Type FS Type [Label] Size (MB)
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Pri/Log Free Space 32212.26 *