歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

linux 磁盤擴容

[root@iZ9488z4qfcZ www]# umount /alidata

umount: /alidata: device is busy.

(In some cases useful info about processes that use

the device is found by lsof(8) or fuser(1))

[root@iZ9488z4qfcZ www]# fuser -m /alidata/

/alidata/: 2296c

[root@iZ9488z4qfcZ www]# kill 2296

[root@iZ9488z4qfcZ www]# umount /alidata

umount: /alidata: device is busy.

(In some cases useful info about processes that use

the device is found by lsof(8) or fuser(1))

[root@iZ9488z4qfcZ www]# fuser -m /alidata

/alidata: 2296c

[root@iZ9488z4qfcZ www]# ps aux |grep 2296

root 2296 0.0 0.0 108456 1900 pts/0 S 22:54 0:00 bash

root 2547 0.0 0.0 103172 828 pts/0 S+ 23:06 0:00 grep 2296

[root@iZ9488z4qfcZ www]# kill -9 2296

Killed (core dumped)

[root@iZ9488z4qfcZ ~]# fdisk /dev/svdb1

Unable to open /dev/svdb1

[root@iZ9488z4qfcZ ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/xvda1 20641404 3201844 16391036 17% /

tmpfs 1960556 0 1960556 0% /dev/shm

/dev/xvdb1 20635700 15126612 4460852 78% /alidata

[root@iZ9488z4qfcZ ~]# umount /dev/xvdb1

[root@iZ9488z4qfcZ ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/xvda1 20641404 3201844 16391036 17% /

tmpfs 1960556 0 1960556 0% /dev/shm

[root@iZ9488z4qfcZ ~]# fdisk -l

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

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

Device Boot Start End Blocks Id System

/dev/xvda1 * 1 2611 20970496 83 Linux

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes

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

Device Boot Start End Blocks Id System

/dev/xvdb1 1 2610 20964793+ 83 Linux

[root@iZ9488z4qfcZ ~]# fdisk /dev/xvdb

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

Selected partition 1

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-13054, default 1):

Using default value 1

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

Using default value 13054

Command (m for help): wq

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@iZ9488z4qfcZ ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/xvda1 20641404 3201844 16391036 17% /

tmpfs 1960556 0 1960556 0% /dev/shm

[root@iZ9488z4qfcZ ~]# fdisk -l

Disk /dev/xvda: 21.5 GB, 21474836480 bytes

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

Device Boot Start End Blocks Id System

/dev/xvda1 * 1 2611 20970496 83 Linux

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes

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

Device Boot Start End Blocks Id System

/dev/xvdb1 1 13054 104856223+ 83 Linux

[root@iZ9488z4qfcZ ~]# e2fsck -f /dev/xvdb1

e2fsck 1.41.12 (17-May-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/xvdb1: 207395/1310720 files (0.4% non-contiguous), 3863926/5241198 blocks

[root@iZ9488z4qfcZ ~]# resize2fs /dev/xvdb1

resize2fs 1.41.12 (17-May-2010)

Resizing the filesystem on /dev/xvdb1 to 26214055 (4k) blocks.

The filesystem on /dev/xvdb1 is now 26214055 blocks long.

[root@iZ9488z4qfcZ ~]# mount /dev/xvdb1 /alidata

[root@iZ9488z4qfcZ ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/xvda1 20641404 3201844 16391036 17% /

tmpfs 1960556 0 1960556 0% /dev/shm

/dev/xvdb1 103210940 15142664 82825484 16% /alidata

[root@iZ9488z4qfcZ ~]# cd /alidata/

[root@iZ9488z4qfcZ vmfx]# df -H

Filesystem Size Used Avail Use% Mounted on

/dev/xvda1 22G 3.3G 17G 17% /

tmpfs 2.1G 0 2.1G 0% /dev/shm

/dev/xvdb1 106G 16G 85G 16% /alidata

[root@iZ9488z4qfcZ vmfx]# reboot

Copyright © Linux教程網 All Rights Reserved