Scenario : Customer needs to expand Data volume after expanding array size in Linux.
Possibilities : only Last Partitions can be expanded through Resize2fs
Recommendation : Please ask customer to take backup of File systems/system.
Step to be followed:
Suppose you have a Partition called c0d0p7 in last cylinder and mounted as a ext3.
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p2 15G 4.5G 9.3G 33% /
/dev/cciss/c0d0p1 99M 12M 83M 12% /boot
None 4.0G 0 4.0G 0% /dev/shm
/dev/cciss/c0d0p6 46G 85M 44G 1% /name1
/dev/cciss/c0d0p7 46G 103M 44G 1% /name2
1) Un mount that file system/Mount point
2) Now you have to remove Journal feature ( if it is ext3 file system) from the file system
# tune2fs -O ^has_journal /dev/cciss/c0d0p7 # tune2fs 1.35 (Date)
Now you have to run e2fsck command to check file systems.
3) root@ff13manish /]# e2fsck -f -y /dev/cciss/c0d0p7
e2fsck 1.35 (Date) Pass
Pass 1: Checking inodes, blocks, and sizes Pass
Pass 2: Checking directory structure Pass
Pass 3: Checking directory connectivity Pass
Pass 4: Checking reference counts Pass
Pass 5: Checking group summary information
/Name2: 16/6111232 files (6.3% non-contiguous), 209772/12209392 blocks
4) Execute the fdisk -l command
Disk /dev/cciss/c0d0: 220.1 GB, 220122071040 bytes
255 heads, 63 sectors/track, 26761 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Devic Boot Start End Blocks Id System
System /dev/cciss/c0d0p1 1 13 104391 83 linux
/dev/cciss/c0d0p2 14 1925 15358140 83 linux
Linux /dev/cciss/c0d0p3 1926 3455 12289725 82 linux swap
/dev/cciss/c0d0p4 3456 26761 187205445 5 Extended
/dev/cciss/c0d0p5 3456 9535 48837568+ 83 Linux
/dev/cciss/c0d0p6 9536 15615 48837568+ 83 Linux
/dev/cciss/c0d0p7 15616 21695 48837568+ 83 Linux Original Cylinder size with 46GB
Command (m for help): quit
“Delete the Last partition and create it again”.
5) [root@ff13manish /]# fdisk /dev/cciss/c0d0
The number of cylinders for this disk is set to 26761. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:
a.Software that runs at boot time (e.g., old versions of LILO)
b.Booting and partitioning software from other OS’s (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): d
Partition number (1-7): 7
“Don’t Quit here with save option , you have to continue without coming out from fdisk Menu”
Command (m for help): n
First cylinder (15616-26761, default 15616)
Using default value 15616
Last cylinder or +size or +sizeM or +sizeK (15616-26761, default 26761)
Using default value 26761
Command (m for help): p
Disk /dev/cciss/c0d0: 220.1 GB, 220122071040 bytes
255 heads, 63 sectors/track, 26761 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 13 104391 83 linux
/dev/cciss/c0d0p2 14 1925 15358140 83 Linux
/dev/cciss/c0d0p3 1926 3455 12289725 82 Linux swap
/dev/cciss/c0d0p4 3456 26761 187205445 5 Extended
/dev/cciss/c0d0p5 3456 9535 48837568+ 83 Linux
/dev/cciss/c0d0p6 9536 15615 48837568+ 83 Linux
/dev/cciss/c0d0p7 15616 26761 89530213+ 83 Linux (Now Size moves to 89 GB)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks.
6) Execute Partprobe command
# partprobe
7) Execute Reszie2fs command
[root@ff13manish /]# resize2fs /dev/cciss/c0d0p7
resize2fs 1.35 (Date)
Resizing the filesystem on /dev/cciss/c0d0p7 to 22382553 (4k) blocks
The filesystem on /dev/cciss/c0d0p7 is now 22382553 blocks long.
8) Now enable ext3 feature in filesystems
tune2fs -j /dev/cciss/c0d0p7
tune2fs 1.35 (Date)
Creating journal inode: done
This filesystem will be automatically checked every 22 mounts or 180 days, whichever comes first.
Use tune2fs -c or -i to override.
Now check by mounting the filesystems
[root@ff13manish /]# mount -t ext3 /dev/cciss/c0d0p7 /Name2
[root@ff13manish /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p2 15G 4.5G 9.3G 33% /
/dev/cciss/c0d0p1 99M 12M 83M 12% /boot
None 4.0G 0 4.0G 0% /dev/shm
/dev/cciss/c0d0p6 46G 85M 44G 1% /Name1
/dev/cciss/c0d0p7 85G 107M 83G 1% /Name2
Check your data :
[root@ff13vel /]# cd /name2
[root@ff13vel name2]# ls
lost+found report-4b79378d-0000265d-00000003.zip RHEL 4 AS UTILITY FOR LINUX
[root@ff13vel name2]# ls -al
total 104
drwxr-xr-x 4 root root 4096 Feb 17 11:27 .
drwxr-xr-x 29 root root 4096 Feb 17 10:08 ..
drwx------2 root root 16384 Feb 16 17:01 lost+found
-rw-r--r--1 root root 67517 Feb 15 18:27 report-4b79378d-0000265d-00000003.zip
drwxr-xr-x 2 root root 4096 Feb 15 16:57 RHEL 4 AS UTILITY FOR LIN
0 comments:
Post a Comment