【记录】调整ext4分区大小

发表于2017-06-26    类别: 技术(65)    标签: 记录(25) Ubuntu(11)

记录一下调整linux ext4分区大小的命令

$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 149.1 GiB, 160041885696 bytes, 312581808 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
Disklabel type: dos
Disk identifier: 0xb73e72de

Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1        2048 62916607 62914560  30G 83 Linux

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-312581807, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-312581807, default 312581807): +30G

Created a new partition 1 of type 'Linux' and of size 30 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

clean@clean-M:~$ sudo e2fsck -f /dev/sdb1
e2fsck 1.42.13 (17-May-2015)
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/sdb1: 7765/1966080 files (2.1% non-contiguous), 397783/7864320 blocks
clean@clean-M:~$ sudo resize2fs -p /dev/sdb1
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 7864320 (4k) blocks long.  Nothing to do!

相关文章

   2023-12-31 【记录】浮点数存储方式
   2021-01-05 【转载】使用iotop监控磁盘I/O
   2017-06-10 【转载】如何启用Ubuntu的休眠模式
   2017-06-09 【记录】Ubuntu 16.04安装Android Studio
   2017-06-04 【记录】Ubuntu 16.04 Config and Installing
   2017-06-04 【记录】Ubuntu 16.04安装中文输入法
   2017-05-29 【收藏】一些命令收集(持续更新)
   2017-05-22 【收藏】自己修改编译ubuntu终端
   2017-05-22 【记录】Setup Samba server on ubuntu 16.04
   2017-05-19 【收藏】Ubuntu16.04下设置终端的标题