虚拟机磁盘扩容

简介:

问题描叙:虚拟机,磁盘空间不足,增加硬盘,进行分区,格式化,挂载,开机自动挂载。


[root@12c ~]# cd /dev
[root@12c dev]# ls
agpgart log pts sda3 tty19 tty42 tty9
autofs loop0 ram0 sda4 tty2 tty43 ttyS0
block loop1 ram1 sda5 tty20 tty44 ttyS1
bsg loop2 ram10 sdb tty21 tty45 ttyS2
btrfs-control loop3 ram11 sg0 tty22 tty46 ttyS3
cdrom loop4 ram12 sg1 tty23 tty47 uinput
cdrw loop5 ram13 sg2 tty24 tty48 urandom
char loop6 ram14 shm tty25 tty49 usbmon0
console loop7 ram15 snapshot tty26 tty5 vcs
core lp0 ram2 sr0 tty27 tty50 vcs1
cpu lp1 ram3 stderr tty28 tty51 vcs2
cpu_dma_latency lp2 ram4 stdin tty29 tty52 vcs3
crash lp3 ram5 stdout tty3 tty53 vcs4
disk MAKEDEV ram6 systty tty30 tty54 vcs5
dvd mapper ram7 tty tty31 tty55 vcs6
dvdrw mcelog ram8 tty0 tty32 tty56 vcsa
fb mem ram9 tty1 tty33 tty57 vcsa1
fb0 net random tty10 tty34 tty58 vcsa2
fd network_latency raw tty11 tty35 tty59 vcsa3
full network_throughput root tty12 tty36 tty6 vcsa4
fuse null rtc tty13 tty37 tty60 vcsa5
hpet nvram rtc0 tty14 tty38 tty61 vcsa6
hugepages oldmem scd0 tty15 tty39 tty62 vga_arbiter
hvc0 port sda tty16 tty4 tty63 zero
input ppp sda1 tty17 tty40 tty7
kmsg ptmx sda2 tty18 tty41 tty8
[root@12c dev]# ll sdb
brw-rw----. 1 root disk 8, 16 10月 16 01:29 sdb
[root@12c dev]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x11951286.
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): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 
Using default value 2610

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@12c dev]# mkfs /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000

正在写入inode表: 完成 
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@12c dev]# ll
总用量 0
crw-rw----. 1 root video 10, 175 10月 16 01:29 agpgart
crw-rw----. 1 root root 10, 57 10月 16 01:29 autofs
drwxr-xr-x. 2 root root 700 10月 16 01:31 block
drwxr-xr-x. 2 root root 100 10月 16 01:29 bsg
crw-------. 1 root root 10, 234 10月 16 01:29 btrfs-control
lrwxrwxrwx. 1 root root 3 10月 16 01:29 cdrom -> sr0
lrwxrwxrwx. 1 root root 3 10月 16 01:29 cdrw -> sr0
drwxr-xr-x. 2 root root 2560 10月 16 01:29 char
crw-------. 1 root root 5, 1 10月 16 01:29 console
lrwxrwxrwx. 1 root root 11 10月 16 01:29 core -> /proc/kcore
drwxr-xr-x. 3 root root 80 10月 16 01:29 cpu
crw-rw----. 1 root root 10, 61 10月 16 01:29 cpu_dma_latency
crw-rw----. 1 root root 10, 62 10月 16 01:29 crash
drwxr-xr-x. 6 root root 120 10月 16 01:29 disk
lrwxrwxrwx. 1 root root 3 10月 16 01:29 dvd -> sr0
lrwxrwxrwx. 1 root root 3 10月 16 01:29 dvdrw -> sr0
lrwxrwxrwx. 1 root root 3 10月 16 01:29 fb -> fb0
crw-rw----. 1 root root 29, 0 10月 16 01:29 fb0
lrwxrwxrwx. 1 root root 13 10月 16 01:29 fd -> /proc/self/fd
crw-rw-rw-. 1 root root 1, 7 10月 16 01:29 full
crw-rw-rw-. 1 root root 10, 229 10月 16 01:29 fuse
crw-rw----. 1 root root 10, 228 10月 16 01:29 hpet
drwxr-xr-x. 2 root root 40 10月 16 01:29 hugepages
crw-------. 1 root root 229, 0 10月 16 01:29 hvc0
drwxr-xr-x. 3 root root 200 10月 16 01:29 input
crw-rw----. 1 root root 1, 11 10月 16 01:29 kmsg
srw-rw-rw-. 1 root root 0 10月 16 01:29 log
brw-rw----. 1 root disk 7, 0 10月 16 01:29 loop0
brw-rw----. 1 root disk 7, 1 10月 16 01:29 loop1
brw-rw----. 1 root disk 7, 2 10月 16 01:29 loop2
brw-rw----. 1 root disk 7, 3 10月 16 01:29 loop3
brw-rw----. 1 root disk 7, 4 10月 16 01:29 loop4
brw-rw----. 1 root disk 7, 5 10月 16 01:29 loop5
brw-rw----. 1 root disk 7, 6 10月 16 01:29 loop6
brw-rw----. 1 root disk 7, 7 10月 16 01:29 loop7
crw-rw----. 1 root lp 6, 0 10月 16 01:29 lp0
crw-rw----. 1 root lp 6, 1 10月 16 01:29 lp1
crw-rw----. 1 root lp 6, 2 10月 16 01:29 lp2
crw-rw----. 1 root lp 6, 3 10月 16 01:29 lp3
lrwxrwxrwx. 1 root root 13 10月 16 01:29 MAKEDEV -> /sbin/MAKEDEV
drwxr-xr-x. 2 root root 60 10月 16 01:29 mapper
crw-rw----. 1 root root 10, 227 10月 16 01:29 mcelog
crw-r-----. 1 root kmem 1, 1 10月 16 01:29 mem
drwxr-xr-x. 2 root root 60 10月 16 01:29 net
crw-rw----. 1 root root 10, 60 10月 16 01:29 network_latency
crw-rw----. 1 root root 10, 59 10月 16 01:29 network_throughput
crw-rw-rw-. 1 root root 1, 3 10月 16 01:29 null
crw-r-----. 1 root kmem 10, 144 10月 16 01:29 nvram
crw-rw----. 1 root root 1, 12 10月 16 01:29 oldmem
crw-r-----. 1 root kmem 1, 4 10月 16 01:29 port
crw-------. 1 root root 108, 0 10月 16 01:29 ppp
crw-rw-rw-. 1 root tty 5, 2 10月 16 01:31 ptmx
drwxr-xr-x. 2 root root 0 10月 16 01:29 pts
brw-rw----. 1 root disk 1, 0 10月 16 01:29 ram0
brw-rw----. 1 root disk 1, 1 10月 16 01:29 ram1
brw-rw----. 1 root disk 1, 10 10月 16 01:29 ram10
brw-rw----. 1 root disk 1, 11 10月 16 01:29 ram11
brw-rw----. 1 root disk 1, 12 10月 16 01:29 ram12
brw-rw----. 1 root disk 1, 13 10月 16 01:29 ram13
brw-rw----. 1 root disk 1, 14 10月 16 01:29 ram14
brw-rw----. 1 root disk 1, 15 10月 16 01:29 ram15
brw-rw----. 1 root disk 1, 2 10月 16 01:29 ram2
brw-rw----. 1 root disk 1, 3 10月 16 01:29 ram3
brw-rw----. 1 root disk 1, 4 10月 16 01:29 ram4
brw-rw----. 1 root disk 1, 5 10月 16 01:29 ram5
brw-rw----. 1 root disk 1, 6 10月 16 01:29 ram6
brw-rw----. 1 root disk 1, 7 10月 16 01:29 ram7
brw-rw----. 1 root disk 1, 8 10月 16 01:29 ram8
brw-rw----. 1 root disk 1, 9 10月 16 01:29 ram9
crw-rw-rw-. 1 root root 1, 8 10月 16 01:29 random
drwxr-xr-x. 2 root root 60 10月 16 01:29 raw
lrwxrwxrwx. 1 root root 4 10月 16 01:29 root -> sda5
lrwxrwxrwx. 1 root root 4 10月 16 01:29 rtc -> rtc0
crw-rw----. 1 root root 254, 0 10月 16 01:29 rtc0
lrwxrwxrwx. 1 root root 3 10月 16 01:29 scd0 -> sr0
brw-rw----. 1 root disk 8, 0 10月 16 01:29 sda
brw-rw----. 1 root disk 8, 1 10月 16 01:29 sda1
brw-rw----. 1 root disk 8, 2 10月 16 01:29 sda2
brw-rw----. 1 root disk 8, 3 10月 16 01:29 sda3
brw-rw----. 1 root disk 8, 4 10月 16 01:29 sda4
brw-rw----. 1 root disk 8, 5 10月 16 01:29 sda5
brw-rw----. 1 root disk 8, 16 10月 16 01:31 sdb
brw-rw----. 1 root disk 8, 17 10月 16 01:31 sdb1
crw-rw----. 1 root disk 21, 0 10月 16 01:29 sg0
crw-rw----. 1 root disk 21, 1 10月 16 01:29 sg1
crw-rw----. 1 root cdrom 21, 2 10月 16 01:29 sg2
drwxrwxrwt. 2 root root 80 10月 16 01:30 shm
crw-rw----. 1 root root 10, 231 10月 16 01:29 snapshot
brw-rw----+ 1 root cdrom 11, 0 10月 16 01:29 sr0
lrwxrwxrwx. 1 root root 15 10月 16 01:29 stderr -> /proc/self/fd/2
lrwxrwxrwx. 1 root root 15 10月 16 01:29 stdin -> /proc/self/fd/0
lrwxrwxrwx. 1 root root 15 10月 16 01:29 stdout -> /proc/self/fd/1
lrwxrwxrwx. 1 root root 4 10月 16 01:29 systty -> tty0
crw-rw-rw-. 1 root tty 5, 0 10月 16 01:29 tty
crw--w----. 1 root tty 4, 0 10月 16 01:29 tty0
crw--w----. 1 root tty 4, 1 10月 16 01:29 tty1
crw--w----. 1 root tty 4, 10 10月 16 01:29 tty10
crw--w----. 1 root tty 4, 11 10月 16 01:29 tty11
crw--w----. 1 root tty 4, 12 10月 16 01:29 tty12
crw--w----. 1 root tty 4, 13 10月 16 01:29 tty13
crw--w----. 1 root tty 4, 14 10月 16 01:29 tty14
crw--w----. 1 root tty 4, 15 10月 16 01:29 tty15
crw--w----. 1 root tty 4, 16 10月 16 01:29 tty16
crw--w----. 1 root tty 4, 17 10月 16 01:29 tty17
crw--w----. 1 root tty 4, 18 10月 16 01:29 tty18
crw--w----. 1 root tty 4, 19 10月 16 01:29 tty19
crw-------. 1 root root 4, 2 10月 16 01:29 tty2
crw--w----. 1 root tty 4, 20 10月 16 01:29 tty20
crw--w----. 1 root tty 4, 21 10月 16 01:29 tty21
crw--w----. 1 root tty 4, 22 10月 16 01:29 tty22
crw--w----. 1 root tty 4, 23 10月 16 01:29 tty23
crw--w----. 1 root tty 4, 24 10月 16 01:29 tty24
crw--w----. 1 root tty 4, 25 10月 16 01:29 tty25
crw--w----. 1 root tty 4, 26 10月 16 01:29 tty26
crw--w----. 1 root tty 4, 27 10月 16 01:29 tty27
crw--w----. 1 root tty 4, 28 10月 16 01:29 tty28
crw--w----. 1 root tty 4, 29 10月 16 01:29 tty29
crw-------. 1 root root 4, 3 10月 16 01:29 tty3
crw--w----. 1 root tty 4, 30 10月 16 01:29 tty30
crw--w----. 1 root tty 4, 31 10月 16 01:29 tty31
crw--w----. 1 root tty 4, 32 10月 16 01:29 tty32
crw--w----. 1 root tty 4, 33 10月 16 01:29 tty33
crw--w----. 1 root tty 4, 34 10月 16 01:29 tty34
crw--w----. 1 root tty 4, 35 10月 16 01:29 tty35
crw--w----. 1 root tty 4, 36 10月 16 01:29 tty36
crw--w----. 1 root tty 4, 37 10月 16 01:29 tty37
crw--w----. 1 root tty 4, 38 10月 16 01:29 tty38
crw--w----. 1 root tty 4, 39 10月 16 01:29 tty39
crw-------. 1 root root 4, 4 10月 16 01:29 tty4
crw--w----. 1 root tty 4, 40 10月 16 01:29 tty40
crw--w----. 1 root tty 4, 41 10月 16 01:29 tty41
crw--w----. 1 root tty 4, 42 10月 16 01:29 tty42
crw--w----. 1 root tty 4, 43 10月 16 01:29 tty43
crw--w----. 1 root tty 4, 44 10月 16 01:29 tty44
crw--w----. 1 root tty 4, 45 10月 16 01:29 tty45
crw--w----. 1 root tty 4, 46 10月 16 01:29 tty46
crw--w----. 1 root tty 4, 47 10月 16 01:29 tty47
crw--w----. 1 root tty 4, 48 10月 16 01:29 tty48
crw--w----. 1 root tty 4, 49 10月 16 01:29 tty49
crw-------. 1 root root 4, 5 10月 16 01:29 tty5
crw--w----. 1 root tty 4, 50 10月 16 01:29 tty50
crw--w----. 1 root tty 4, 51 10月 16 01:29 tty51
crw--w----. 1 root tty 4, 52 10月 16 01:29 tty52
crw--w----. 1 root tty 4, 53 10月 16 01:29 tty53
crw--w----. 1 root tty 4, 54 10月 16 01:29 tty54
crw--w----. 1 root tty 4, 55 10月 16 01:29 tty55
crw--w----. 1 root tty 4, 56 10月 16 01:29 tty56
crw--w----. 1 root tty 4, 57 10月 16 01:29 tty57
crw--w----. 1 root tty 4, 58 10月 16 01:29 tty58
crw--w----. 1 root tty 4, 59 10月 16 01:29 tty59
crw-------. 1 root root 4, 6 10月 16 01:29 tty6
crw--w----. 1 root tty 4, 60 10月 16 01:29 tty60
crw--w----. 1 root tty 4, 61 10月 16 01:29 tty61
crw--w----. 1 root tty 4, 62 10月 16 01:29 tty62
crw--w----. 1 root tty 4, 63 10月 16 01:29 tty63
crw--w----. 1 root tty 4, 7 10月 16 01:29 tty7
crw--w----. 1 root tty 4, 8 10月 16 01:29 tty8
crw--w----. 1 root tty 4, 9 10月 16 01:29 tty9
crw-rw----. 1 root dialout 4, 64 10月 16 01:29 ttyS0
crw-rw----. 1 root dialout 4, 65 10月 16 01:29 ttyS1
crw-rw----. 1 root dialout 4, 66 10月 16 01:29 ttyS2
crw-rw----. 1 root dialout 4, 67 10月 16 01:29 ttyS3
crw-r-----. 1 root root 10, 223 10月 16 01:29 uinput
crw-rw-rw-. 1 root root 1, 9 10月 16 01:29 urandom
crw-rw----. 1 root root 250, 0 10月 16 01:29 usbmon0
crw-rw----. 1 vcsa tty 7, 0 10月 16 01:29 vcs
crw-rw----. 1 vcsa tty 7, 1 10月 16 01:29 vcs1
crw-rw----. 1 vcsa tty 7, 2 10月 16 01:29 vcs2
crw-rw----. 1 vcsa tty 7, 3 10月 16 01:29 vcs3
crw-rw----. 1 vcsa tty 7, 4 10月 16 01:29 vcs4
crw-rw----. 1 vcsa tty 7, 5 10月 16 01:29 vcs5
crw-rw----. 1 vcsa tty 7, 6 10月 16 01:29 vcs6
crw-rw----. 1 vcsa tty 7, 128 10月 16 01:29 vcsa
crw-rw----. 1 vcsa tty 7, 129 10月 16 01:29 vcsa1
crw-rw----. 1 vcsa tty 7, 130 10月 16 01:29 vcsa2
crw-rw----. 1 vcsa tty 7, 131 10月 16 01:29 vcsa3
crw-rw----. 1 vcsa tty 7, 132 10月 16 01:29 vcsa4
crw-rw----. 1 vcsa tty 7, 133 10月 16 01:29 vcsa5
crw-rw----. 1 vcsa tty 7, 134 10月 16 01:29 vcsa6
crw-rw----. 1 root root 10, 63 10月 16 01:29 vga_arbiter
crw-rw-rw-. 1 root root 1, 5 10月 16 01:29 zero
[root@12c dev]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 14G 12G 1.9G 86% /
tmpfs 750M 72K 750M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
/dev/sda3 1.9G 9.4M 1.8G 1% /tmp
[root@12c dev]# ls
agpgart log pts sda3 tty18 tty41 tty8
autofs loop0 ram0 sda4 tty19 tty42 tty9
block loop1 ram1 sda5 tty2 tty43 ttyS0
bsg loop2 ram10 sdb tty20 tty44 ttyS1
btrfs-control loop3 ram11 sdb1 tty21 tty45 ttyS2
cdrom loop4 ram12 sg0 tty22 tty46 ttyS3
cdrw loop5 ram13 sg1 tty23 tty47 uinput
char loop6 ram14 sg2 tty24 tty48 urandom
console loop7 ram15 shm tty25 tty49 usbmon0
core lp0 ram2 snapshot tty26 tty5 vcs
cpu lp1 ram3 sr0 tty27 tty50 vcs1
cpu_dma_latency lp2 ram4 stderr tty28 tty51 vcs2
crash lp3 ram5 stdin tty29 tty52 vcs3
disk MAKEDEV ram6 stdout tty3 tty53 vcs4
dvd mapper ram7 systty tty30 tty54 vcs5
dvdrw mcelog ram8 tty tty31 tty55 vcs6
fb mem ram9 tty0 tty32 tty56 vcsa
fb0 net random tty1 tty33 tty57 vcsa1
fd network_latency raw tty10 tty34 tty58 vcsa2
full network_throughput root tty11 tty35 tty59 vcsa3
fuse null rtc tty12 tty36 tty6 vcsa4
hpet nvram rtc0 tty13 tty37 tty60 vcsa5
hugepages oldmem scd0 tty14 tty38 tty61 vcsa6
hvc0 port sda tty15 tty39 tty62 vga_arbiter
input ppp sda1 tty16 tty4 tty63 zero
kmsg ptmx sda2 tty17 tty40 tty7
[root@12c dev]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 14G 12G 1.9G 86% /
tmpfs 750M 72K 750M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
/dev/sda3 1.9G 9.4M 1.8G 1% /tmp
[root@12c dev]# cd /
[root@12c /]# mkdir u02
[root@12c /]# ls
bin dev home lib64 media mnt opt root selinux sys u02 var
boot etc lib lost+found misc net proc sbin srv tmp usr
[root@12c /]# rm -r u02
rm:是否删除目录 "u02"?y
[root@12c /]# mkdir u01
[root@12c /]# ls
bin dev home lib64 media mnt opt root selinux sys u01 var
boot etc lib lost+found misc net proc sbin srv tmp usr
[root@12c /]# mount /dev/sdb1 /u01
[root@12c /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 14G 12G 1.9G 86% /
tmpfs 750M 72K 750M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
/dev/sda3 1.9G 9.4M 1.8G 1% /tmp
/dev/sdb1 20G 44M 19G 1% /u01

[root@12c /]# chown oracle:oinstall /u01

后续还需要弄一下开机自动挂载



本文转自 张冲andy 博客园博客,原文链接:http://www.cnblogs.com/andy6/p/6034742.html   ,如需转载请自行联系原作者


相关文章
|
18天前
|
KVM 虚拟化
kvm虚拟机磁盘管理
文章详细介绍了KVM虚拟机磁盘管理,包括磁盘格式概述、创建虚拟机时如何指定磁盘格式、以及磁盘工具的常用命令,旨在帮助用户更好地理解和操作KVM虚拟机的磁盘管理。
40 1
kvm虚拟机磁盘管理
|
2月前
|
SQL 存储 数据库
虚拟化数据恢复—XenServer虚拟机磁盘文件丢失的数据恢复案例
虚拟化数据恢复环境: 某品牌R720服务器,4块STAT硬盘通过H710P阵列卡组建了一组raid10磁盘阵列。服务器上部署XenServer虚拟化平台,虚拟机安装Windows Server系统,作为Web服务器使用,运行SQL Server数据库。共有2个虚拟磁盘:数据盘+系统盘。 虚拟化故障: 机房断电导致XenServer虚拟化平台中一台VPS不可用,XenServer虚拟机磁盘文件丢失。
虚拟化数据恢复—XenServer虚拟机磁盘文件丢失的数据恢复案例
|
3月前
|
存储 开发框架 安全
虚拟机磁盘&UAC&服务和注册表&int文件
虚拟机磁盘&UAC&服务和注册表&int文件
|
4月前
|
存储 弹性计算 运维
|
4月前
|
Linux 虚拟化
linux 虚拟机扩容--直接扩容到根目录
linux 虚拟机扩容--直接扩容到根目录
82 1
|
4月前
|
存储 弹性计算 运维
|
11月前
|
Linux 虚拟化
VMware虚拟机中Linux系统磁盘空间扩容实战
VMware虚拟机中Linux系统磁盘空间扩容实战
551 0
|
Ubuntu 虚拟化 Windows
将Vmware虚拟机磁盘映射到本地实现文件传输
将虚拟机磁盘映射到本地,可以实现文件互传,更方便使用,在开发时可以替代SecureFx等FTP客户端软件
527 0
|
4月前
|
Ubuntu 虚拟化
百度搜索:蓝易云【虚拟机磁盘大小变更后的Ubuntu动态分区调整教程】
现在,你已经成功将Ubuntu虚拟机的动态分区调整为新的磁盘大小。你可以通过 `df -h`命令来查看文件系统的新大小。注意,在进行此操作时,请务必备份重要数据,并确保你了解分区操作的风险和影响。
54 0
|
9月前
|
数据挖掘 数据库 虚拟化
服务器数据恢复—XenServer虚拟机磁盘文件丢失的数据恢复案例
服务器数据恢复环境: 某品牌720服务器搭配该品牌某型号RAID卡,使用4块STAT硬盘组建了一组RAID10阵列。服务器上部署XenServer虚拟化平台,系统盘 +数据盘两个虚拟机磁盘。虚拟机上安装的是Windows Server操作系统,作为Web服务器使用,网站使用的是SQLServer数据库。 服务器故障: 服务器意外断电导致XenServer中一台VPS(XenServer虚拟机)不可用,虚拟磁盘文件丢失。
服务器数据恢复—XenServer虚拟机磁盘文件丢失的数据恢复案例