C. VMware下LINUX的虚拟机增加磁盘空间

先关闭虚拟机电源,做如下设置:“ 虚拟机”--“虚拟机设置”--“磁盘”--“扩展”


image.png
一,显示分区:
[root@hadoop01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_hadoop01-lv_root
                      8.3G  1.7G  6.2G  22% /
tmpfs                 491M     0  491M   0% /dev/shm
/dev/sda1             477M   34M  418M   8% /boot

二,开始分区:
[root@hadoop01 ~]# fdisk /dev/sda

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): p

Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 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: 0x0003f262

   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        1306     9972736   8e  Linux LVM

四,分区:
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1306-1958, default 1306): 
Using default value 1306
Last cylinder, +cylinders or +size{K,M,G} (1306-1958, default 1958): 2G
Value out of range.
Last cylinder, +cylinders or +size{K,M,G} (1306-1958, default 1958): +2G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Selected partition 4
First cylinder (1568-1958, default 1568): 4
Value out of range.
First cylinder (1568-1958, default 1568): 
Using default value 1568
Last cylinder, +cylinders or +size{K,M,G} (1568-1958, default 1958): 
Using default value 1958

五,保存:
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

六,重启:
[root@hadoop01 ~]# reboot

Broadcast message from root@hadoop01
    (/dev/pts/0) at 17:44 ...

The system is going down for reboot NOW!
[root@hadoop01 ~]# Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(Zhu) at 09:44:02.

Type `help' to learn how to use Xshell prompt.
[c:\~]$ 

Connecting to 192.168.190.134:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Thu Aug 30 17:41:00 2018 from 192.168.190.1

七,格式化:
[root@hadoop01 ~]# mkfs.ext3 /dev/sda3
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131376 inodes, 525291 blocks
26264 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=541065216
17 block groups
32768 blocks per group, 32768 fragments per group
7728 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912

正在写入inode表: 完成                            
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@hadoop01 ~]# mkfs.ext3 /dev/sda4
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
196608 inodes, 785176 blocks
39258 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912

正在写入inode表: 完成                            
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

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


[root@hadoop01 ~]# cd /
[root@hadoop01 /]# ll
总用量 90
dr-xr-xr-x.   2 root root  4096 7月  16 19:31 bin
dr-xr-xr-x.   5 root root  1024 7月  16 19:32 boot
drwxr-xr-x.  21 root root  3820 8月  30 17:44 dev
drwxr-xr-x.  76 root root  4096 8月  30 17:44 etc
drwxr-xr-x.   2 root root  4096 9月  23 2011 home
dr-xr-xr-x.   8 root root  4096 7月  16 19:31 lib
dr-xr-xr-x.   9 root root 12288 7月  16 22:10 lib64
drwx------.   2 root root 16384 7月  16 19:28 lost+found
drwxr-xr-x.   2 root root  4096 9月  23 2011 media
drwxr-xr-x.   2 root root  4096 9月  23 2011 mnt
drwxr-xr-x.   4 root root  4096 7月  16 23:32 opt
dr-xr-xr-x. 103 root root     0 8月  30 17:44 proc
dr-xr-x---.   3 root root  4096 8月  29 01:06 root
dr-xr-xr-x.   2 root root 12288 7月  16 22:10 sbin
drwxr-xr-x.   7 root root     0 8月  30 17:44 selinux
drwxr-xr-x.   2 root root  4096 9月  23 2011 srv
drwxr-xr-x   13 root root     0 8月  30 17:44 sys
drwxrwxrwt.   3 root root  4096 8月  30 17:44 tmp
drwxr-xr-x.  13 root root  4096 7月  16 19:30 usr
drwxr-xr-x.  18 root root  4096 7月  16 19:32 var
[root@hadoop01 /]# cd mnt
[root@hadoop01 mnt]# ll
总用量 0
[root@hadoop01 mnt]# mkdir music
[root@hadoop01 mnt]# mkdir movie
[root@hadoop01 mnt]# ll
总用量 8
drwxr-xr-x. 2 root root 4096 8月  30 17:48 movie
drwxr-xr-x. 2 root root 4096 8月  30 17:48 music

八,挂载:
[root@hadoop01 mnt]# mount /dev/sda3 /mnt/music/
[root@hadoop01 mnt]# mount /dev/sda4 /mnt/movie/

九,显示:
[root@hadoop01 mnt]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_hadoop01-lv_root
                      8.3G  1.7G  6.2G  22% /
tmpfs                 491M     0  491M   0% /dev/shm
/dev/sda1             477M   34M  418M   8% /boot
/dev/sda3             2.0G   68M  1.9G   4% /mnt/music
/dev/sda4             3.0G   69M  2.8G   3% /mnt/movie

设置开机自动加载:

#
# /etc/fstab
# Created by anaconda on Mon Jul 16 19:29:55 2018
#
# 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
#
/dev/mapper/vg_hadoop01-lv_root /                       ext4    defaults        1 1
UUID=25a8ff10-0622-438c-a4ed-5e84424e2a84 /boot                   ext4    defaults        1 2
/dev/mapper/vg_hadoop01-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

/dev/sda3       /mnt/music      ext3    defaults        0       0
/dev/sda4       /mnt/movie      ext3    defaults        0       0
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
~                                                                                                                 
:wq

重启reboot

扩展分区的设立:

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1306-1697, default 1306): +1G
Value out of range.
First cylinder (1306-1697, default 1306): 
Using default value 1306
Last cylinder, +cylinders or +size{K,M,G} (1306-1697, default 1697): +1G

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM
/dev/sda3            1306        1437     1056942+  83  Linux

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM
/dev/sda3            1306        1437     1056942+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
4
Invalid partition number for type `4'
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First cylinder (1438-1697, default 1438): 
Using default value 1438
Last cylinder, +cylinders or +size{K,M,G} (1438-1697, default 1697): 
Using default value 1697

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM
/dev/sda3            1306        1437     1056942+  83  Linux
/dev/sda4            1438        1697     2088450    5  Extended

Command (m for help): n
First cylinder (1438-1697, default 1438): 
Using default value 1438
Last cylinder, +cylinders or +size{K,M,G} (1438-1697, default 1697): +1G

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM
/dev/sda3            1306        1437     1056942+  83  Linux
/dev/sda4            1438        1697     2088450    5  Extended
/dev/sda5            1438        1569     1060258+  83  Linux

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM
/dev/sda3            1306        1437     1056942+  83  Linux
/dev/sda4            1438        1697     2088450    5  Extended
/dev/sda5            1438        1569     1060258+  83  Linux

Command (m for help): n
First cylinder (1570-1697, default 1570): 
Using default value 1570
Last cylinder, +cylinders or +size{K,M,G} (1570-1697, default 1697): 
Using default value 1697

Command (m for help): p

Disk /dev/sda: 14.0 GB, 13958643712 bytes
255 heads, 63 sectors/track, 1697 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: 0x00079ba6

   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        1306     9972736   8e  Linux LVM
/dev/sda3            1306        1437     1056942+  83  Linux
/dev/sda4            1438        1697     2088450    5  Extended
/dev/sda5            1438        1569     1060258+  83  Linux
/dev/sda6            1570        1697     1028128+  83  Linux

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@hadoop01 ~]# reboot

U盘挂载:

[root@hadoop01 /]# mount /dev/sdb1 /mnt/udisk/ -o iocharset=utf8
[root@hadoop01 /]# cd /mnt/udisk/
[root@hadoop01 udisk]# ll
总用量 47392
drwxr-xr-x.  2 root root    32768 8月  30 17:10 20100830
drwxr-xr-x.  7 root root    32768 8月   8 11:17 20160807
drwxr-xr-x.  2 root root    32768 8月   8 08:55 20160808
drwxr-xr-x.  4 root root    32768 8月   9 17:30 20160809
drwxr-xr-x.  4 root root    32768 8月   6 16:07 20180806
drwxr-xr-x.  5 root root    32768 8月  10 17:09 20180810
drwxr-xr-x.  4 root root    32768 8月  16 17:22 20180816
drwxr-xr-x.  8 root root    32768 8月  21 17:03 20180820
drwxr-xr-x.  4 root root    32768 8月  22 11:53 20180822
drwxr-xr-x.  6 root root    32768 8月  23 17:05 20180823
drwxr-xr-x.  7 root root    32768 8月  24 16:47 20180824
drwxr-xr-x.  3 root root    32768 8月  27 17:07 20180827
drwxr-xr-x.  2 root root    32768 8月  29 11:53 20180829
drwxr-xr-x.  2 root root    32768 8月  28 17:05 21080828
drwxr-xr-x.  3 root root    32768 3月  12 2016 before
drwxr-xr-x.  5 root root    32768 5月  26 15:06 com
drwxr-xr-x.  2 root root    32768 6月  17 10:46 company
drwxr-xr-x.  2 root root    32768 5月  18 00:34 guessword
-rwxr-xr-x.  1 root root    26411 6月   5 19:38 java基础复习题含解答.docx
drwxr-xr-x. 14 root root    32768 7月  13 07:56 my project
drwxr-xr-x.  2 root root    32768 4月  28 10:15 phpStudy
-rwxr-xr-x.  1 root root 34631350 6月  30 2017 phpStudy.zip
drwxr-xr-x.  2 root root    32768 5月  10 00:40 scott20180510
-rwxr-xr-x.  1 root root   534566 8月  15 11:32 ssm复习题2.docx
-rwxr-xr-x.  1 root root   533829 8月  14 15:04 ssm复习题.docx
drwxr-xr-x.  2 root root    32768 3月  16 2016 System Volume Information
-rwxr-xr-x.  1 root root  4851261 6月  30 2017 vc9_x64(1).zip
-rwxr-xr-x.  1 root root   763043 7月   4 00:25 web前台复习题含解答.docx
drwxr-xr-x.  5 root root    32768 8月  27 00:36 wukongmaven
drwxr-xr-x.  5 root root    32768 6月  20 20:04 youluwangproject
drwxr-xr-x.  5 root root    32768 4月  27 17:08 大数据
-rwxr-xr-x.  1 root root    82432 4月  26 21:49 大数据课程体系(终).doc
-rwxr-xr-x.  1 root root    69777 4月  26 21:49 人工智能课程方案.xlsx
-rwxr-xr-x.  1 root root  5971952 5月   3 2016 深入浅出MySQL全文.pdf
drwxr-xr-x. 28 root root    32768 4月  27 17:08 文件
-rwxr-xr-x.  1 root root     7932 8月  15 13:26 新建文本文档.txt
[root@hadoop01 udisk]# cat java基础复习题含解答.docx 

(二) 解决mount: unknown filesystem type ‘ntfs’ 问题
问题:

  # mount –t ntfs /dev/sdb1 /mnt/
  mount: unknown filesystem type ‘ntfs’ 
  这是由于CentOS release 5.5(Final)上无法识别NTFS格式的分区。 

解决办法:
通过使用 ntfs-3g 来解决。
打开ntfs-3g的下载点http://www.tuxera.com/community/ntfs-3g-download/ ,将最新稳定(当前最新版本为ntfs-3g-2011.1.15)下载到CentOS,执行以下命令安装:

  1. 编译安装 ntfs-3g:

tar zxvf ntfs-3g-2011.1.15.tgz

cd ntfs-3g-2011.1.15

./configure

make

make install

在网上找了,方法一样安上 还是不能挂载,最后在官方站 找到方法了,如下:

mount -t ntfs-3g /dev/sda5 /mnt/windows

磁盘分区

给虚拟机加1块10G大小的虚拟磁盘(中间无截图,选择默认选项即可)


image.png

image.png

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,723评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,080评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,604评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,440评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,431评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,499评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,893评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,541评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,751评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,547评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,619评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,320评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,890评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,896评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,137评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,796评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,335评论 2 342