3

I have a 16Tb partition on Raid 6 array using xfs file system.

# df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sdc1      xfs     15T  7.4T  7.2T  51% /backup

I reconstructed the Raid using LSI Megaraid tool after add a few disks, the virtual drive has been expanded from 16TB to 29TB in Megaraid. However, when I try to grow the xfs system, the size didn't change. The command "xfs_growfs /backup" return immediately without any change.

# xfs_growfs /backup
meta-data=/dev/sdc1              isize=256    agcount=15, agsize=268435455 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=3906469376, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=521728, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

I tried parted, it can't detect the new size as well.

(parted) print /dev/sdc
Model: LSI MR9271-4i (scsi)
Disk /dev/sdc: 16.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  16.0TB  16.0TB  xfs          primary

Previously, I followed this instruction to create the XFS partition. I didn't use LVM.

https://unix.stackexchange.com/questions/29078/how-to-partition-22tb-disk

Update I just rebooted the server, now I can see the partition is 32TB using parted, but I haven't been able to resize the file system using xfs_grow. Parted tool doesn't support xfs.

# parted /dev/sdc
GNU Parted 2.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print /dev/sdc
Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?
parted: invalid token: /dev/sdc
Fix/Ignore/Cancel?
Fix/Ignore/Cancel? fix
Warning: Not all of the space available to /dev/sdc appears to be used, you can fix the GPT to use all of the space (an extra 31251759104 blocks) or continue with the current setting?
Fix/Ignore? fix
Model: LSI MR9271-4i (scsi)
**Disk /dev/sdc: 32.0TB**
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
1      1049kB  16.0TB  16.0TB  xfs          primary

(parted)

garconcn
  • 2,388
  • 8
  • 35
  • 46
  • did you try to read the partition table with partprobe or blockdev? – c4f4t0r Dec 11 '13 at 17:49
  • @c4f4t0r, I just tried these two commands, partprobe didn't return anything, blockdev --rereadpt /dev/sdc returns "BLKRRPART: Device or resource busy" – garconcn Dec 11 '13 at 18:07

2 Answers2

4

You need to modify the partition table to take advantage of the space provided by the LUN expansion. With fdisk, that's normally a deletion of the partition and recreating it with the same start point and new end point. The same is probably true on the parted side.

Once this this is done, you can reboot or use a tool like partprobe (assuming the mounted device is not in use) and once that's done, mount the filesystem and run xfs_growfs /mountpoint. The XFS growth tool only works on mounted filesystems.

ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • thanks for the help, this works, but fdisk doesn't work here. I tried using fdisk to delete the partition and recreate it, it only create a 2Tb partition. Then, I tried using parted, I was able to resize it. I didn't know that deleting a partition will not destroy the data. – garconcn Dec 11 '13 at 19:38
1

If you use the lun with lvm and without partition, you can do it in a simple way like this:

  1. echo 1 > /sys/block/sdc/device/rescan
  2. pvresize /dev/sdc
  3. lvresize or lvextend of your lvm volume
  4. xfs_growfs
masegaloeh
  • 18,236
  • 10
  • 57
  • 106
c4f4t0r
  • 5,301
  • 3
  • 31
  • 42