Linux增加磁盘

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 20:22   1478   0


fdisk -l 会看到有一块新的设置,如果你先前有一块硬盘(sda1, sda2...),新加的这块应该是(/dev/sdb)

1.pvcreate -v /dev/sdb (创建物理卷)

pvcreate: Initialize physical volume(s) for use by LVM

pvcreate
[--restorefile file]
[-d|--debug]
[-f[f]|--force [--force]]
[-h|-?|--help]
[--labelsector sector]
[-M|--metadatatype 1|2]
[--metadatacopies #copies]
[--metadatasize MetadataSize[kKmMgGtTpPeE]]
[--setphysicalvolumesize PhysicalVolumeSize[kKmMgGtTpPeE]
[-t|--test]
[-u|--uuid uuid]
[-v|--verbose] 冗长的,详细的
[-y|--yes]
[-Z|--zero {y|n}]
[--version]
PhysicalVolume [PhysicalVolume...]


2.vgcreate -v oradatavg /dev/sdb (创建卷组)
vgcreate: Create a volume group

vgcreate
[-A|--autobackup {y|n}]
[--addtag Tag]
[--alloc AllocationPolicy]
[-c|--clustered {y|n}]
[-d|--debug]
[-h|--help]
[-l|--maxlogicalvolumes MaxLogicalVolumes]
[-M|--metadatatype 1|2]
[-p|--maxphysicalvolumes MaxPhysicalVolumes]
[-s|--physicalextentsize PhysicalExtentSize[kKmMgGtTpPeE]]
[-t|--test]
[-v|--verbose]
[--version]
VolumeGroupName PhysicalVolume [PhysicalVolume...]


3.lvcreate -v -L 7.5G -n lv_oradata /dev/oradatavg (创建逻辑卷)
lvcreate: Create a logical volume

lvcreate
[-A|--autobackup {y|n}]
[--addtag Tag]
[--alloc AllocationPolicy]
[-C|--contiguous {y|n}]
[-d|--debug]
[-h|-?|--help]
[-i|--stripes Stripes [-I|--stripesize StripeSize]]
{-l|--extents LogicalExtentsNumber |
-L|--size LogicalVolumeSize[kKmMgGtTpPeE]}
[-M|--persistent {y|n}] [--major major] [--minor minor]
[-m|--mirrors Mirrors [--nosync] [--corelog]]
[-n|--name LogicalVolumeName]
[-p|--permission {r|rw}]
[-r|--readahead ReadAheadSectors]
[-R|--regionsize MirrorLogRegionSize]
[-t|--test]
[--type VolumeType]
[-v|--verbose]
[-Z|--zero {y|n}]
[--version]
VolumeGroupName [PhysicalVolumePath...]

lvcreate -s|--snapshot
[-c|--chunksize]
[-A|--autobackup {y|n}]
[--addtag Tag]
[--alloc AllocationPolicy]
[-C|--contiguous {y|n}]
[-d|--debug]
[-h|-?|--help]
[-i|--stripes Stripes [-I|--stripesize StripeSize]]
{-l|--extents LogicalExtentsNumber[%{VG|LV|FREE}] |
-L|--size LogicalVolumeSize[kKmMgGtTpPeE]}
[-M|--persistent {y|n}] [--major major] [--minor minor]
[-n|--name LogicalVolumeName]
[-p|--permission {r|rw}]
[-r|--readahead ReadAheadSectors]
[-t|--test]
[-v|--verbose]
[--version]
OriginalLogicalVolume[Path] [PhysicalVolumePath...]


4.mkfs.ext2 /dev/oradatavg/lv_oradata (创建文件系统)

5.mkdir /oradata

6.mount /dev/oradatavg/lv_oradata /oradata (加载)

7.chown -R oracle:dba /oradata (授权)

8.vi /etc/fstab 添加 /dev/oradatavg/lv_oradata /oradata ext2 defaults 0 0


# fstab文件格式
  下面是/etc/fatab文件的一个示例行:
  fs_spec fs_file fs_type fs_options fs_dump fs_pass

fs_spec - 该字段定义希望加载的文件系统所在的设备或远程文件系统,对于一般的本地块设备情况来说:IDE设备一般描述为/dev/hdaXN,X是IDE设备通道 (a, b, or c),N代表分区号;SCSI设备一描述为/dev/sdaXN。对于NFS情况,格式一般为<host>:<dir>,例如: `knuth.aeb.nl:/'。对于procfs,使用`proc'来定义。

  fs_file - 该字段描述希望的文件系统加载的目录点,对于swap设备,该字段为none;对于加载目录名包含空格的情况,用40来表示空格。

  fs_type - 定义了该设备上的文件系统,一般常见的文件类型为ext2 (Linux设备的常用文件类型)、vfat(Windows系统的fat32格式)、NTFS、iso9600等。

  fs_options - 指定加载该设备的文件系统是需要使用的特定参数选项,多个参数是由逗号分隔开来。对于大多数系统使用"defaults"就可以满足需要。其他常见的选项包括:

fs_dump - 该选项被"dump"命令使用来检查一个文件系统应该以多快频率进行转储,若不需要转储就设置该字段为0

  fs_pass - 该字段被fsck命令用来决定在启动时需要被扫描的文件系统的顺序,根文件系统"/"对应该字段的值应该为1,其他文件系统应该为2。若该文件系统无需在启动时扫描则设置该字段为0

例子如下:

1.pvcreate -v /dev/sdb (创建物理卷)


2.vgcreate -v oradatavg /dev/sdb (创建卷组)


3.lvcreate -v -L 7.5G -n lv_oradata /dev/oradatavg (创建逻辑卷)


4.mkfs.ext2 /dev/oradatavg/lv_oradata (创建文件系统)


5.mkdir /oradata


6.mount /dev/oradatavg/lv_oradata /oradata (加载)


7.chown -R oracle:dba /oradata (授权)


8.vi /etc/fstab 添加 /dev/oradatavg/lv_oradata /oradata ext2 defaults 0 0

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP