linux root fsresize,[转载]用resize2fs 扩展linux分区大小

root@SHZ-VM-001:/# fdisk /dev/sdb

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/sdb: 322.1 GB, 322122547200 bytes

255 heads, 63 sectors/track, 39162 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: 0x76148198

Device Boot

Start

End  Blocks  Id

System

/dev/sdb1  1  26108  209712478+  83  Linux

Command (m for help): m

Command action

a  toggle a bootable flag

b  edit

bsd disklabel

c  toggle the dos compatibility flag

d  delete a partition

l  list

known partition types

m  print this menu

n  add

a new partition

o  create a new empty DOS partition table

p  print the partition table

q  quit

without saving changes

s  create a new empty Sun disklabel

t  change a partition's system id

u  change display/entry units

v  verify the partition table

w  write table to disk and exit

x  extra functionality (experts only)

Command (m for help): d

Selected partition 1

Command (m for help): p

Disk /dev/sdb: 322.1 GB, 322122547200 bytes

255 heads, 63 sectors/track, 39162 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: 0x76148198

Device Boot

Start

End  Blocks  Id

System

Command (m for help): m

Command action

a  toggle a bootable flag

b  edit

bsd disklabel

c  toggle the dos compatibility flag

d  delete a partition

l  list

known partition types

m  print this menu

n  add

a new partition

o  create a new empty DOS partition table

p  print the partition table

q  quit

without saving changes

s  create a new empty Sun disklabel

t  change a partition's system id

u  change display/entry units

v  verify the partition table

w  write table to disk and exit

x  extra functionality (experts only)

Command (m for help): n

Command action

e  extended

p  primary partition (1-4)

p

Partition number (1-4):

Value out of range.

Partition number (1-4): 1

First cylinder (1-39162, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-39162, default

39162):

Using default value 39162

Command (m for help): p

Disk /dev/sdb: 322.1 GB, 322122547200 bytes

255 heads, 63 sectors/track, 39162 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: 0x76148198

Device Boot

Start

End  Blocks  Id

System

/dev/sdb1  1  39162  314568733+  83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

root@SHZ-VM-001:/#

root@SHZ-VM-001:/#

root@SHZ-VM-001:/#

root@SHZ-VM-001:/# resize2fs /dev/sdb1

resize2fs 1.41.11 (14-Mar-2010)

Please run 'e2fsck -f /dev/sdb1' first.

root@SHZ-VM-001:/# e2fsck -f /dev/sdb1

e2fsck 1.41.11 (14-Mar-2010)

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: 474754/13107200 files (0.4% non-contiguous),

45135492/52428119 blocks

root@SHZ-VM-001:/# resize2fs /dev/sdb1

resize2fs 1.41.11 (14-Mar-2010)

Resizing the filesystem on /dev/sdb1 to 78642183 (4k)

blocks.

The filesystem on /dev/sdb1 is now 78642183 blocks long.

root@SHZ-VM-001:/# mount /dev/sdb1 /lv_backup/

root@SHZ-VM-001:/# ls -l /lv_backup/

lost+found/  rsync_backup/

root@SHZ-VM-001:/# ls -l /lv_backup/rsync_backup/

total 24

drwxr-xr-x  6 root  root

4096 2014-07-14 15:26 dmz

drwxr-xr-x 60 nobody root 4096 2014-07-15 04:00

forge-router

drwxr-xr-x  4 nobody root 4096 2014-06-17

11:21 sz01003

drwxr-xr-x  2 nobody root 4096 2014-07-14

15:17 sz01006

drwxr-xr-x  4 nobody root 4096 2014-06-17

22:00 sz01007

drwxr-xr-x  5 nobody root 4096 2014-06-17

12:54 sz01009

root@SHZ-VM-001:/# df -h

Filesystem  Size  Used Avail Use% Mounted

on

/dev/sda1  76G  15G

58G  21% /

none  1001M  172K

1001M  1% /dev

none  1005M  0 1005M  0% /dev/shm

none  1005M  60K

1005M  1% /var/run

none  1005M  0 1005M  0% /var/lock

none  1005M  0 1005M  0% /lib/init/rw

/dev/sdb1  296G  170G

112G  61% /lv_backup

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值