Resize partition using parted

12,518

I guess the older version of parted was not great.

I used Gparted Live(latest parted version) on USB and booted it. That seems to make it work! I was able to expand the partition using "resizepart".

Finally, after rebooting the filesystem was expanded using "xfs_growfs".

df output:

[root@backup-serv ~]# df -hT
Filesystem           Type   Size  Used Avail Use% Mounted on
/dev/mapper/Root_VG-Root
                     ext4   107G   78G   24G  77% /
tmpfs                tmpfs   32G     0   32G   0% /dev/shm
/dev/sda1            ext4   870M  154M  672M  19% /boot
/dev/sdb1            xfs    119T   81T   38T  69% /export/bak
Share:
12,518

Related videos on Youtube

user8802482
Author by

user8802482

Updated on September 18, 2022

Comments

  • user8802482
    user8802482 over 1 year

    There is a pretty big file-server(~85TB) running xfs file system, on Centos 6.9 which we use for our backups.

    We were out of space, so I added 10 new similar drives to the array and rebuilt RAID 6 using Mega Raid Manager, which took nearly a fortnight. So, the total capacity is ~150TB and with the virtual drive it is ~135 TB.

    I planned to use "parted" to expand the partition size:

    [root@backup-serv ~]# parted /dev/sdb
    GNU Parted 2.1
    Using /dev/sdb
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) print                                                            
    Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the
    space (an extra 14649917440 blocks) or continue with the current setting?
    Fix/Ignore? Ignore                                                        
    Model: LSI SMC3108 (scsi)
    Disk /dev/sdb: 150TB
    Sector size (logical/physical): 4096B/4096B
    Partition Table: gpt
    Number  Start   End     Size       File system  Name  Flags
     1      1049kB  90.0TB  90.0TB                  1
    

    Note: File system does not display anything.

    I have 60 TB fre space as shown below:

    (parted) print free
    Model: LSI SMC3108 (scsi)
    Disk /dev/sdb: 150TB
    Sector size (logical/physical): 4096B/4096B
    Partition Table: gpt
    Number  Start   End     Size    File system  Name  Flags
            24.6kB  1049kB  1024kB  Free Space
     1      1049kB  90.0TB  90.0TB               1
            90.0TB  150TB   60.0TB  Free Space
    

    It shows there is 60 TB of free space. So, when I try to expand the "partition 1", I get the following( could not detect file system error).:

    (parted) resize
    WARNING: you are attempting to use parted to operate on (resize) a file system.
    parted's file system manipulation code is not as robust as what you'll find in
    dedicated, file-system-specific packages like e2fsprogs.  We recommend
    you use parted only to manipulate partition tables, whenever possible.
    Support for performing most operations on most types of file systems
    will be removed in an upcoming release.
    Partition number? 1                                                       
    Start?  [1049kB]? 1049kB                                                  
    End?  [90.0TB]? 130.0TB                                                   
    Error: Could not detect file system.
    

    df output:

    [root@backup-serv ~]# df -hT
    Filesystem           Type   Size  Used Avail Use% Mounted on
    /dev/mapper/Root_VG-Root
                         ext4   107G   78G   24G  77% /
    tmpfs                tmpfs   32G     0   32G   0% /dev/shm
    /dev/sda1            ext4   870M  154M  672M  19% /boot
    /dev/sdb1            xfs     82T   81T  1.2T  99% /export/bak
    

    Why is parted not detecting the filesystem?

  • George Y
    George Y about 5 years
    Well you have found out it is the bug of parted. Why not try gdisk instead?
  • user8802482
    user8802482 about 5 years
    I think it was the bug of an older version of parted
  • George Y
    George Y about 4 years
    I do not like parted at all. For the size calculation is always flawed.
  • Admin
    Admin almost 2 years
    It was not a bug. There was a debate years ago about if parted should be even doing that bugzilla.redhat.com/show_bug.cgi?id=807101