1

Have a quick question on adding space via a new disk/block device to a non-root/ext3 mount-point that has data and is mounted.

I Have an ext3 mountpoint '/u01', which has a device '/dev/sdb' attached.

[root@vm2 ~]# findmnt -l /u01
TARGET SOURCE   FSTYPE OPTIONS
/u01   /dev/sdb ext3   rw,relatime,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered

Problem is this device is almost full (67%) and cannot be extended.

[root@vm2 ~]# df -Th /u01
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sdb       ext3   12G  7.5G  3.8G  67% /u01
[root@vm2 ~]#

So I added another device '/dev/sdk' of size 20g and partitioned it as below.

[root@vm2 ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0    5G  0 disk
├─sda1        8:1    0  500M  0 part /boot
└─sda2        8:2    0  4.5G  0 part
  ├─ol-root 252:0    0   16G  0 lvm  /
  └─ol-swap 252:1    0  512M  0 lvm  [SWAP]
sdb           8:16   0   12G  0 disk /u01
sdc           8:32   0   30G  0 disk /u02
sdd           8:48   0   30G  0 disk /u03
sde           8:64   0    4G  0 disk /redo1
sdf           8:80   0    4G  0 disk /redo2
sdg           8:96   0    4G  0 disk /cntl1
sdh           8:112  0    4G  0 disk /cntl2
sdi           8:128  0    6G  0 disk /gghome
sdj           8:144  0   12G  0 disk
└─sdj1        8:145  0   12G  0 part
  └─ol-root 252:0    0   16G  0 lvm  /
sdk           8:160  0   20G  0 disk
└─sdk1        8:161  0   20G  0 part
sr0          11:0    1 1024M  0 rom
[root@vm2 ~]#

I want to understand if this new device '/dev/sdk1' can also be added the mount-point '/u01' so as to resize it to 12g(sdb) + 20g(sdk1), so that when I move heavy files to /u01, I dont get a space error.

There are no clear methods I saw so far which describe the same. Mostly people talk about extending the root partition(xfs), but for me, this '/u01' is not mounted on the root partition, but on a separate ext3.

Here are some outputs which may help.

[root@vm2 ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/mapper/ol-root xfs        16G  3.5G   13G  22% /
devtmpfs            devtmpfs  2.4G     0  2.4G   0% /dev
tmpfs               tmpfs     2.4G   80K  2.4G   1% /dev/shm
tmpfs               tmpfs     2.4G  8.9M  2.4G   1% /run
tmpfs               tmpfs     2.4G     0  2.4G   0% /sys/fs/cgroup
/dev/sda1           xfs       497M  149M  349M  30% /boot
/dev/sdb            ext3       12G  7.5G  3.8G  67% /u01
/dev/sdc            ext3       30G  5.9G   23G  21% /u02
/dev/sdi            ext3      6.0G  141M  5.5G   3% /gghome
/dev/sdh            ext3      4.0G  137M  3.7G   4% /cntl2
/dev/sdd            ext3       30G  173M   28G   1% /u03
/dev/sde            ext3      4.0G  137M  3.7G   4% /redo1
/dev/sdg            ext3      4.0G  137M  3.7G   4% /cntl1
/dev/sdf            ext3      4.0G  137M  3.7G   4% /redo2

Physical Volume Display (PVDISPLAY)

[root@vm2 ~]# pvdisplay /dev/sdk1
  --- Physical volume ---
  PV Name               /dev/sdk1
  VG Name               ol
  PV Size               20.00 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              5119
  Free PE               5119
  Allocated PE          0
  PV UUID               5tsaXp-bz1j-UwLS-lLRk-capI-i4rW-ps9Lk4

Volume Group Display (vgdisplay)

[root@vm2 ~]# vgdisplay
  --- Volume group ---
  VG Name               ol
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                4
  Act PV                3
  VG Size               86.50 GiB
  PE Size               4.00 MiB
  Total PE              22143
  Alloc PE / Size       4225 / 16.50 GiB
  Free  PE / Size       17918 / 69.99 GiB
  VG UUID               Jfwpry-P7rO-NocS-DrVA-J3q2-tIOR-fkE41G

Logical Volume Display (lvdisplay)

[root@vm2 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ol/swap
  LV Name                swap
  VG Name                ol
  LV UUID                3ZrLkL-JGYa-8EdA-oW7S-uCS2-dbmS-KdCI1h
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-03-06 14:40:27 -0800
  LV Status              available
  # open                 2
  LV Size                512.00 MiB
  Current LE             128
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:1

  --- Logical volume ---
  LV Path                /dev/ol/root
  LV Name                root
  VG Name                ol
  LV UUID                WXQ5ne-UYgM-A53J-s1KE-ec72-Y52x-K5Qb1v
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-03-06 14:40:27 -0800
  LV Status              available
  # open                 1
  LV Size                16.00 GiB
  Current LE             4097
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           252:0

I have already tried the below which fails and does'nt show the new device added to '/u01', which does'nt work

[root@vm2 ~]# umount /u01
[root@vm2 ~]# mount /dev/sdk1 /u01

Here is my fstab file as well.

[root@vm2 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sun Mar  6 22:40:28 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/ol-root     /                       xfs     defaults        0 0
UUID=22363586-3aee-4128-aa86-4ff1ff7f30a2 /boot                   xfs     defaults        0 0
/dev/mapper/ol-swap     swap                    swap    defaults        0 0

/dev/sdb       /u01   auto    defaults,nofail        0       2
/dev/sdc       /u02   auto    defaults,nofail        0       2
/dev/sdd       /u03   auto    defaults,nofail        0       2
/dev/sde       /redo1   auto    defaults,nofail        0       2
/dev/sdf       /redo2   auto    defaults,nofail        0       2
/dev/sdg       /cntl1   auto    defaults,nofail        0       2
/dev/sdh       /cntl2   auto    defaults,nofail        0       2
/dev/sdi       /gghome   auto    defaults,nofail        0       2

Lastly the Linux version

[root@vm2 ~]# uname -a
Linux vm2 3.8.13-55.1.6.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22 PST 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@vm2 ~]#

FYI : this server/vm cannot connect to the internet to download custom rpm or packages like mhddfs or unionfs. So restricted to traditional approaches.

Any help is appreciated.

Thanks N23

n23n23
  • 13
  • 2

1 Answers1

4

No, you can't extend an ext* filesystem using an additional block device. It always resides on a single block device.

So if you can extend the size of /dev/sdb (for example, if that's a volume abstrsaction from a RAID card, or if this is a VM) then that will work. Either a reboot or scsi bus rescan should update the block device size, after which you can run resize2fs /dev/sdb while that volume is unmounted.

You could move your data to an LVM volume (via a file-based copy), and I'd recommend this in general regardless. LVM gives you a much more dynamic block device and will add features to your storage that are completely transparent to ext3 (such as the ability to online extend EXT3's block device and span that single block device across several disks - a feature that would have saved you the need to make this post).

You can make a new volume group and a 20 GiB logical volume like so:

wipefs -a /dev/sdk
vgcreate vg0 /dev/sdk
lvcreate -n lv0 -L 20G vg0

And then you can make a new ext3 filesystem on that resulting block device which you can copy your files to.

mkfs -t ext3 /dev/vg0/lv0
Spooler
  • 7,016
  • 16
  • 29
  • Thanks Spooler, However I do have a requirement to preserve the '/u01' path due to software library issues which get reffered to a path inside /u01... So do you think it makes sense to detach this device (/dev/sdb) from the host via the virtualbox GUI and increase the size and re-attach ? – n23n23 Mar 17 '19 at 01:26
  • Copying the data to an lvm-backed disk does not require changing your mount path. You can update the /etc/fstab file with the new block device path after you perform the copy. However, if you can increase the disk size in virtualbox, that's the easiest way to go about this. – Spooler Mar 17 '19 at 02:07