• 虚拟机磁盘扩容


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


    [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

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

  • 相关阅读:
    django之数据库orm
    Python的迭代器和生成器
    xhprof 安装使用
    http_load
    sysbench
    LINUX系统下MySQL 压力测试工具super smack
    apache ab工具
    关于流量升高导致TIME_WAIT增加,MySQL连接大量失败的问题
    mysql5.6优化
    php-fpm超时时间设置request_terminate_timeout分析
  • 原文地址:https://www.cnblogs.com/andy6/p/6034742.html
Copyright © 2020-2023  润新知