Linux挂载新硬盘(linux挂载新硬盘并指定目录)

fangcloud 268 2022-07-06

本文转载自网络公开信息

Linux6.4虚拟机环境安装了Oracle 11g R2,在RMAN的时候,扩展了快速恢复区,导致空间不够用,所以在VMware Workstation中给虚拟机加了一个10G的硬盘。再挂载到虚拟机中,记录,备用!

1.在VM虚拟机中添加好硬盘,重启虚拟机

2.root用户登录到虚拟机,查看磁盘情况

[root@grainliu /]# cd ..[root@grainliu /]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00069687

Device Boot      Start         End      Blocks   Id  System/dev/sda1               1         262     2097152   82  Linux swap / SolarisPartition 1 does not end on cylinder boundary./dev/sda2   *         262        2611    18873344   83  Linux

Disk /dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0xc63ae59b

Device Boot      Start         End      Blocks   Id  System/dev/sdb1               1        2610    20964793+  83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000

查出/dev/sdc是新加的大小为10G的磁盘

3.对磁盘进行分区处理

[root@grainliu /]# fdisk /dev/sdcDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0x6c49e48e.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to         switch off the mode (command 'c') and change display units to         sectors (command 'u').

Command (m for help): nCommand action   e   extended   p   primary partition (1-4)pPartition number (1-4): 1First cylinder (1-1305, default 1): Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): Using default value 1305

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

Calling ioctl() to re-read partition table.Syncing disks.

4.查看分区加载的情况

[root@grainliu /]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00069687

Device Boot      Start         End      Blocks   Id  System/dev/sda1               1         262     2097152   82  Linux swap / SolarisPartition 1 does not end on cylinder boundary./dev/sda2   *         262        2611    18873344   83  Linux

Disk /dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0xc63ae59b

Device Boot      Start         End      Blocks   Id  System/dev/sdb1               1        2610    20964793+  83  Linux

Disk /dev/sdc: 10.7 GB, 10737418240 bytes255 heads, 63 sectors/track, 1305 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x6c49e48e

Device Boot      Start         End      Blocks   Id  System/dev/sdc1               1        1305    10482381   83  Linux

/dev/sdc1为新加载的区

5.格式化新的分区

[root@grainliu /]# mkfs -t ext3 /dev/sdc1mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks655360 inodes, 2620595 blocks131029 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=268435456080 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

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

This filesystem will be automatically checked every 22 mounts or180 days, whichever comes first.  Use tune2fs -c or -i to override.

格式化完成

6.在根目录下创建目录,将新分区加载到创建的目录下

[root@grainliu /]# mkdir /u02[root@grainliu /]# lsbin  boot  cgroup  dev  etc  home  lib  lib64  lost+found  media  misc  mnt  net  opt  proc  root  sbin  selinux  srv  sys  tmp  u01  u02  usr  var

[root@grainliu /]# mount /dev/sdc1 /u02

7.验证是否挂载

[root@grainliu /]# df -kFilesystem           1K-blocks      Used Available Use% Mounted on/dev/sda2             18577148  12856908   4776576  73% /tmpfs                   771488        72    771416   1% /dev/shm/dev/sdb1             20635700   3016928  16570536  16% /u01.host:/              157593596  99913120  57680476  64% /mnt/hgfs/dev/sdc1             10317828    154232   9639480   2% /u02

8.设置开机自动挂载

[root@grainliu /]# vi /etc/fstab

## /etc/fstab# Created by anaconda on Wed Jun 19 06:44:20 2013## Accessible filesystems, by reference, are maintained under '/dev/disk'# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#UUID=55f9330b-f964-4efe-8949-e4a080a9bc02 /                       ext4    defaults        1 1UUID=2bdf0c98-5a08-421b-8375-421fed017ca3 swap                    swap    defaults        0 0tmpfs                   /dev/shm                tmpfs   defaults        0 0devpts                  /dev/pts                devpts  gid=5,mode=620  0 0sysfs                   /sys                    sysfs   defaults        0 0proc                    /proc                   proc    defaults        0 0/dev/sdb1               /u01                    ext3    defaults        0 0/dev/sdc1               /u02                    ext3    dufaults        0 0

保存,退出。

完成加载

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表亿方云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱daifeng@360.cn 处理。
上一篇:ASM下更换磁盘(asm磁盘组管理命令)
下一篇:开机挂载磁盘(Windows磁盘挂载)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~