Selasa, 16 April 2019

How to extend disk size root partition on Suse Linux 11 SP 4

  Tidak ada komentar
Check the disk size
bpmdb:~ # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       146G  140G  5.2G  97% /
udev             16G  1.2M   16G   1% /dev
tmpfs            16G  1.3M   16G   1% /dev/shm
/dev/sr0        3.3G  3.3G     0 100% /mountdisk
/dev/sr0        3.3G  3.3G     0 100% /cd0
/dev/sr0        3.3G  3.3G     0 100% /mnt/cdrom
/dev/sr1        5.1G  5.1G     0 100% /cd1
bpmdb:~ #
bpmdb:~ # fdisk -l

Disk /dev/sda: 161.1 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders, total 314572800 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   314572799   154973184   83  Linux
bpmdb:~ #
Check the block disk
bpmdb:~ # lsblk
NAME   MAJ:MIN RM   SIZE RO MOUNTPOINT
sda      8:0    0   150G  0
├─sda1   8:1    0 403.5K  0
├─sda2   8:2    0     2G  0 [SWAP]
└─sda3   8:3    0 147.8G  0 /
sr0     11:0    1   3.2G  0 /mountdisk
sr1     11:1    1     5G  0 /cd1
bpmdb:~ #
Extend the phisical disk size

Rescan the disk
bpmdb:~ # echo 1 > /sys/block/sda/device/rescan
bpmdb:~ #
bpmdb:~ # fdisk -l

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   314572799   154973184   83  Linux
bpmdb:~ #
Check the disk list
bpmdb:~ # fdisk -l

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   314572799   154973184   83  Linux
inaportnetbpmdb:~ #
inaportnetbpmdb:~ # fdisk /dev/sda

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):
Command (m for help): p

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   314572799   154973184   83  Linux

Command (m for help):
Command (m for help): d
Partition number (1-4): 3

Command (m for help): p

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 3): 3
First sector (2855-524287999, default 2855): 4626432
Last sector, +sectors or +size{K,M,G} (4626432-524287999, default 524287999):
Using default value 524287999

Command (m for help): p

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   524287999   259830784   83  Linux

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
1e  Hidden W95 FAT1 80  Old Minix
Hex code (type L to list codes): 83

Command (m for help): p

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   524287999   259830784   83  Linux

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 or after you run partprobe(8) or kpartx(8)
Syncing disks.
bpmdb:~ #
bpmdb:~ # partprobe
Error: Partition(s) 3 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.
Warning: The driver descriptor says the physical block size is 512 bytes, but Linux says it is 2048 bytes.
Warning: Unable to open /dev/sr1 read-write (Read-only file system).  /dev/sr1 has been opened read-only.
Warning: Unable to open /dev/sr1 read-write (Read-only file system).  /dev/sr1 has been opened read-only.
bpmdb:~ #
Reboot the machine
Resize the disk
bpmdb:~ # resize2fs /dev/sda3
resize2fs 1.41.9 (22-Aug-2009)
Filesystem at /dev/sda3 is mounted on /; on-line resizing required
old desc_blocks = 10, new_desc_blocks = 16
Performing an on-line resize of /dev/sda3 to 64957696 (4k) blocks.
The filesystem on /dev/sda3 is now 64957696 blocks long.

bpmdb:~ # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       244G  140G  103G  58% /
udev             16G  1.2M   16G   1% /dev
tmpfs            16G  1.9M   16G   1% /dev/shm
bpmdb:~ #
bpmdb:~ # fdisk -l

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 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
Disk identifier: 0xd4cf0800

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048        2854         403+  41  PPC PReP Boot
/dev/sda2          417792     4626431     2104320   82  Linux swap / Solaris
/dev/sda3         4626432   524287999   259830784   83  Linux
bpmdb:~ #
bpmdb:~ # lsblk
NAME   MAJ:MIN RM   SIZE RO MOUNTPOINT
sda      8:0    0   250G  0
├─sda1   8:1    0 403.5K  0
├─sda2   8:2    0     2G  0 [SWAP]
└─sda3   8:3    0 247.8G  0 /
sr0     11:0    1   3.2G  0
sr1     11:1    1     5G  0
bpmdb:~ #
bpmdb:~ #

Tidak ada komentar :

Posting Komentar