Pro*_*Guy 7 gparted partitioning vmware-player ubuntu
我在家里使用的 VM 空间不足。它运行Ubuntu服务器,现有空间为20G。我决定将其增加到 100G,以确保我有足够的喘息空间。
所以我按照这里的说明操作:http : //www.rootusers.com/use-gparted-to-increase-disk-size-of-a-linux-native-partition/
一切都很顺利,直到最后一步。尝试将/dev/sda1/
分区大小增加到 99G 在第三步失败:“检查文件系统/dev/sda1
是否有错误并(如果可能)修复它们。”
看起来这一步试图运行: e2fsck -f -y -v /dev/sda1
这会引发一个错误说:
无法读取超级块或未描述正确的 ext2 文件系统。
有问题的分区是 ext3 分区,但我不确定这是否重要。
主分区还是可以的,Ubuntu 还是可以启动的,所以我觉得还可以。关于我需要做什么才能使它更大的任何想法?
编辑 :
fdisk -l
从 gparted 实时磁盘启动时的输出。
Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16064 * 512 = 9225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2481 19921920 83 Linux
/dev/sda2 12924 13054 1052275+ 5 Extended
/dev/sda5 12925 13054 1044225 82 Linux swap / Solaris
Run Code Online (Sandbox Code Playgroud)
编辑 2:
fdisk -l
在 ubuntu 服务器中启动时
有趣的是,正常启动VM后运行时,输出是不同的。
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00044fd6
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 39845887 19921920 83 Linux
/dev/sda2 207607995 209712509 1052257+ 5 Extended
/dev/sda5 207624060 209712509 1044225 82 Linux swap / Solaris
Run Code Online (Sandbox Code Playgroud)
编辑 3:输出 mount | grep " / "
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
Run Code Online (Sandbox Code Playgroud)
感谢fdisk
和mount
输出。
您必须先调整它的大小,最好在从 CD 启动时完成:
~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/sda1 2048 39845887 19921920 83 Linux
/dev/sda2 207607995 209712509 1052257+ 5 Extended
/dev/sda5 207611904 209712509 1050303 82 Linux swap / Solaris
Run Code Online (Sandbox Code Playgroud)
如果在这些“长”数字中没有看到输出,请使用 fdisk 命令u
将单位更改为扇区,然后p
再次打印。
现在删除/dev/sda1
并重新创建更大的尺寸。删除分区只会更改分区表,不会删除任何数据,但是我强烈建议您先拍摄 VM 的快照。
Command (m for help): d
Partition number (1,2,5, default 5): 1
Partition 1 is deleted
Run Code Online (Sandbox Code Playgroud)
现在创建一个新的:
Command (m for help): n
Partition type:
p primary (0 primary, 1 extended, 3 free)
l logical (numbered from 5)
Select (default p): p
Partition number (1,3,4, default 1): 1
First sector (2048-209715199, default 2048): <==== This MUST be the same as in the original partition table!
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-207607994, default 207607994): <== Use the default, will be maximum it can do
Using default value 207607994
Partition 1 of type Linux and of size 99 GiB is set
Run Code Online (Sandbox Code Playgroud)
验证它看起来是否正常:
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/sda1 2048 207607994 103802973+ 83 Linux <=== Note the new size
/dev/sda2 207607995 209712509 1052257+ 5 Extended
/dev/sda5 207611904 209712509 1050303 82 Linux swap / Solaris
Run Code Online (Sandbox Code Playgroud)
并写入磁盘:
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Run Code Online (Sandbox Code Playgroud)
现在检查文件系统的一致性并调整大小:
~# e2fsck -f /dev/sda1
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda1: 11/1245184 files (0.0% non-contiguous), 122210/4980480 blocks
~# resize2fs /dev/sda1
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/sda1 to 25950743 (4k) blocks.
The filesystem on /dev/sda1 is now 25950743 blocks long.
Run Code Online (Sandbox Code Playgroud)
这应该够了吧。