Dec 18

Resize a Linux file system 不指定

, 17:56 , SAP Video , Comments(0) , Trackbacks(0) , Reads(7785) , Via Original Large | Medium | Small
[root@netweaver tmp]# fdisk /dev/sdf

The number of cylinders for this disk is set to 36551.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Command (m for help): p

Disk /dev/sdf: 300.6 GB, 300647710720 bytes
255 heads, 63 sectors/track, 36551 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       27413   220194891   83  Linux

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-36551, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-36551, default 36551):
Using default value 36551

Command (m for help): p

Disk /dev/sdf: 300.6 GB, 300647710720 bytes
255 heads, 63 sectors/track, 36551 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       36551   293595876   83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@netweaver tmp]# df -k
mount Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      91891672  63282984  23865520  73% /
/dev/sda1               101086     12442     83425  13% /boot
/dev/sdb1             51605436  26357640  22626392  54% /oracle/BI7
/dev/sdc1             51605436   8837028  40147004  19% /oracle/EP7
/dev/sdd1             51605436  26190888  22793144  54% /oracle/NW7
/dev/sde1             51605436  20672900  28311132  43% /oracle/SRM
tmpfs                  1933240         0   1933240   0% /dev/shm
nas:/mnt/HD_a2/      958846976 309010432 649836544  33% /NAS
[root@netweaver tmp]# mount -a
[root@netweaver tmp]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      91891672  63282984  23865520  73% /
/dev/sda1               101086     12442     83425  13% /boot
/dev/sdb1             51605436  26357640  22626392  54% /oracle/BI7
/dev/sdc1             51605436   8837028  40147004  19% /oracle/EP7
/dev/sdd1             51605436  26190888  22793144  54% /oracle/NW7
/dev/sde1             51605436  20672900  28311132  43% /oracle/SRM
tmpfs                  1933240         0   1933240   0% /dev/shm
nas:/mnt/HD_a2/      958846976 309010432 649836544  33% /NAS
/dev/sdf1            216739908  95011396 110718768  47% /var/lib/backuppc

[root@netweaver tmp]# which resize2fs
/sbin/resize2fs
[root@netweaver tmp]# resize2fs /dev/sdf1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sdf1 is mounted on /var/lib/backuppc; on-line resizing required

[root@netweaver tmp]#
[root@netweaver tmp]# umount /var/lib/backuppc
[root@netweaver tmp]# resize2fs /dev/sdf1
resize2fs 1.39 (29-May-2006)
Please run 'e2fsck -f /dev/sdf1' first.

[root@netweaver tmp]# e2fsck -f /dev/sdf1
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
BACKUPPC: e2fsck canceled.
[root@netweaver tmp]#
[root@netweaver tmp]#
[root@netweaver tmp]# resize2fs -fF /dev/sdf1
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/sdf1 to 73398969 (4k) blocks.
The filesystem on /dev/sdf1 is now 73398969 blocks long.

[root@netweaver tmp]# mount -a
[root@netweaver tmp]# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      91891672  63283000  23865504  73% /
/dev/sda1               101086     12442     83425  13% /boot
/dev/sdb1             51605436  26357640  22626392  54% /oracle/BI7
/dev/sdc1             51605436   8837028  40147004  19% /oracle/EP7
/dev/sdd1             51605436  26190888  22793144  54% /oracle/NW7
/dev/sde1             51605436  20672900  28311132  43% /oracle/SRM
tmpfs                  1933240         0   1933240   0% /dev/shm
nas:/mnt/HD_a2/      958846976 309010432 649836544  33% /NAS
/dev/sdf1            288989220  95015180 182230208  35% /var/lib/backuppc
[root@netweaver tmp]#
Add a comment

Nickname

Site URI

Email

Enable HTML Enable UBB Enable Emots Hidden Remember [Login] [Register]