Resizing a partition and file system
This procedure assumes the following:
- the datastore is stored in /mnt/addm/db_data
- /mnt/addm/db_data is mounted on the /dev/sdb2 partition
- the result of moving the datastore, including the creation of a swap partition, to a second disk using Disk Management
- LVM has not been used to partition the disk
The following examples use the host testhost, and the tideway or root user as applicable.
To resize a partition and file system
- Create a backup of the appliance. The backup should be stored on a different machine.
- Log in to the appliance command line as the tideway user.
Stop the Discovery services from starting on reboot. Enter the following commands:
[tideway@testhost] $ tw_service_control --stop
[tideway@testhost] $ sudo /bin/systemctl disable cluster
[tideway@testhost] $ sudo /bin/systemctl disable omniNamesExample output to show current partition size:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 4.8G 1.2G 3.4G 26% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.6M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 2.0G 880K 2.0G 1% /tmp
/dev/sda5 4.8G 20M 4.5G 1% /reserved
/dev/sda6 1.9G 6.0M 1.8G 1% /home
/dev/sda1 711M 124M 535M 19% /boot
/dev/sda7 1.7G 139M 1.5G 9% /var
/dev/sda10 40G 2.8G 35G 8% /usr/tideway
/dev/sda8 1.2G 12M 1.1G 2% /var/log
/dev/sda9 852M 3.9M 788M 1% /var/log/audit
tmpfs 380M 0 380M 0% /run/user/1000
/dev/sdb2 187G 2.8G 174G 2% /mnt/addm/db_data
[root@testhost ~]#- Shutdown the Discovery virtual machine and wait for the system to completely power off.
- Increase disk size. In the examples, it is /dev/sdb that is enlarged.
- Start the Discovery virtual machine.
- Log in to the appliance command line as the tideway user and become the root user.
Unmount the datastore partition:
[root@testhost ~]# umount /mnt/addm/db_dataPerform a check on the datastore filesystem:
[root@testhost ~]# e2fsck -f /dev/sdb2
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb2: 850/25247744 files (3.2% non-contiguous), 2344921/50475264 blocks
[root@testhost ~]#- Disable any swap on the same disk:
Find swap partitions running on /dev/sdb
[root@testhost ~]# swapon --summary
Filename Type Size Used Priority
/dev/sda2 partition 8388604 0 -1
/dev/sdb1 partition 7811068 0 -2
[root@testhost ~]#The swap partition /dev/sdb1 shares the disk, /dev/sdb, with the datastore. This must be disabled.
[root@testhost ~]# swapoff /dev/sdb1
[root@testhost ~]# swapon --summary
Filename Type Size Used Priority
/dev/sda2 partition 8388604 0 -1
[root@testhost ~]#
- Resize the partition, using all available space at the end of the disk.
Find the required disk information. Take note of the partition Number and the Start sector from the output, which are 2 and 15624192 respectively in the example. The example shows user input after the (parted) prompt.
[root@testhost ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit s
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 536870912s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 2048s 15624191s 15622144s linux-swap(v1) primary
2 15624192s 419428351s 403802112s ext4 primaryYou may receive the errors and warnings noted below. You must enter Fix and <enter> to both options as these are expected when increasing disk size. The example shows user input after the Fix/Cancel prompt and the Warning: text.
Resize the partition Number noted above and use 100% as the option to use all remaining disk space. The example shows user input after the (parted) prompt.
(parted) resizepart 2
End?
(parted) 100%
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 536870912s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 2048s 15624191s 15622144s linux-swap(v1) primary
2 15624192s 536870878s 521244639s ext4 primary
(parted) quit
Information: You may need to update /etc/fstab.
[root@testhost ~]#Check the partition's filesystem for errors.
[root@testhost ~]# e2fsck -f /dev/sdb2
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb2: 850/25247744 files (3.2% non-contiguous), 2344921/50475264 blocks
[root@testhost ~]#Resize the /dev/sdb2 filesystem to use the entire partition:
[root@testhost ~]# resize2fs /dev/sdb2
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/sdb2 to 65155579 (4k) blocks.
The filesystem on /dev/sdb2 is now 65155579 blocks long.
[root@testhost ~]#Check the partition's filesystem to ensure the resize operation did not cause any corruption.
[root@testhost ~]# e2fsck -f /dev/sdb2
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb2: 850/32587776 files (3.2% non-contiguous), 2804569/65155579 blocks
[root@testhost ~]#Confirm the /etc/fstab file will mount the resized partition correctly. The blkid command will show the UUID of the partition which needs to match the UUID used in /etc/fstab for /mnt/addm/db_data. If the UUID is not the same, the /etc/fstab file will need to be updated. If /dev/sdb2 is used rather than UUID, there is no need to update /etc/fstab.
[root@testhost ~]# blkid /dev/sdb2
/dev/sdb2: UUID="fe656744-9995-4494-87f6-90eed0df80e5" TYPE="ext4"
[14/03/2018 13:41] Wood, Kerryn:
No Title
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Mar 12 23:01:36 2018
#
# 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
#
UUID=3a361c1a-d40c-4770-8572-29eec6e83517 / ext4 defaults 1 1
UUID=c7581dca-d228-4c92-8bc0-0f04e9587ec1 /boot ext4 defaults,nosuid 1 2
UUID=90d53bca-bbb9-4b92-ac69-488af4e3a6e2 /home ext4 defaults,nosuid 1 2
UUID=6f65c692-9d42-4e75-b7f4-c627f9e286b1 /reserved ext4 auto,ro,noexec,nosuid,nouser 1 2
UUID=882843ac-2742-4080-af28-404650b761c0 /usr/tideway ext4 defaults 1 2
UUID=367aa921-0438-4b14-a5ca-4b4dae3d0a11 /var ext4 defaults,noexec 1 2
UUID=19ecb558-a758-4574-9fc6-810a046fd5be /var/log ext4 defaults,noexec 1 2
UUID=6f6eeab2-b2fa-4479-9c43-d8a58a0928e1 /var/log/audit ext4 defaults,noexec 1 2
UUID=94e1b0a3-7f9d-4003-a255-a2c2265368b9 swap swap defaults 0 0
tmpfs /tmp tmpfs size=2048m 0 0
UUID=fe656744-9995-4494-87f6-90eed0df80e5 /mnt/addm/db_data ext4 defaults 1 2
[root@localhost ~]#Mount the new partition using mount -a. This will mount all partitions listed in /etc/fstab.
[root@testhost ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1929584k,nr_inodes=482396,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda3 on / type ext4 (rw,relatime,seclabel,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=11436)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,relatime,seclabel,size=2097152k)
/dev/sda5 on /reserved type ext4 (ro,nosuid,noexec,relatime,seclabel,data=ordered)
/dev/sda6 on /home type ext4 (rw,nosuid,relatime,seclabel,data=ordered)
/dev/sda1 on /boot type ext4 (rw,nosuid,relatime,seclabel,data=ordered)
/dev/sda7 on /var type ext4 (rw,noexec,relatime,seclabel,data=ordered)
/dev/sda10 on /usr/tideway type ext4 (rw,relatime,seclabel,data=ordered)
/dev/sda8 on /var/log type ext4 (rw,noexec,relatime,seclabel,data=ordered)
/dev/sda9 on /var/log/audit type ext4 (rw,noexec,relatime,seclabel,data=ordered)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=388172k,mode=700,uid=1000,gid=1000)
[root@testhost ~]#
[root@testhost ~]# mount -a
[root@testhost ~]#
[root@testhost ~]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1929584k,nr_inodes=482396,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda3 on / type ext4 (rw,relatime,seclabel,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=11436)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,relatime,seclabel,size=2097152k)
/dev/sda5 on /reserved type ext4 (ro,nosuid,noexec,relatime,seclabel,data=ordered)
/dev/sda6 on /home type ext4 (rw,nosuid,relatime,seclabel,data=ordered)
/dev/sda1 on /boot type ext4 (rw,nosuid,relatime,seclabel,data=ordered)
/dev/sda7 on /var type ext4 (rw,noexec,relatime,seclabel,data=ordered)
/dev/sda10 on /usr/tideway type ext4 (rw,relatime,seclabel,data=ordered)
/dev/sda8 on /var/log type ext4 (rw,noexec,relatime,seclabel,data=ordered)
/dev/sda9 on /var/log/audit type ext4 (rw,noexec,relatime,seclabel,data=ordered)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=388172k,mode=700,uid=1000,gid=1000)
/dev/sdb2 on /mnt/addm/db_data type ext4 (rw)
[root@testhost ~]#Confirm the new size:
[root@testhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 4.8G 1.2G 3.4G 26% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.6M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 2.0G 880K 2.0G 1% /tmp
/dev/sda5 4.8G 20M 4.5G 1% /reserved
/dev/sda6 1.9G 6.0M 1.8G 1% /home
/dev/sda1 711M 124M 535M 19% /boot
/dev/sda7 1.7G 139M 1.5G 9% /var
/dev/sda10 40G 2.8G 35G 8% /usr/tideway
/dev/sda8 1.2G 12M 1.1G 2% /var/log
/dev/sda9 852M 3.9M 788M 1% /var/log/audit
tmpfs 380M 0 380M 0% /run/user/1000
/dev/sdb2 241G 2.8G 226G 2% /mnt/addm/db_data
[root@testhost ~]#
- Reboot the Discovery virtual machine.
- Log in to the appliance command line as the tideway user.
Confirm after restart that the partition has mounted as expected:
[tideway@testhost ~]$ sudo /bin/mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1929584k,nr_inodes=482396,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/sda3 on / type ext4 (rw,relatime,seclabel,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=25,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=11436)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,relatime,seclabel,size=2097152k)
/dev/sda5 on /reserved type ext4 (ro,nosuid,noexec,relatime,seclabel,data=ordered)
/dev/sda6 on /home type ext4 (rw,nosuid,relatime,seclabel,data=ordered)
/dev/sda1 on /boot type ext4 (rw,nosuid,relatime,seclabel,data=ordered)
/dev/sda7 on /var type ext4 (rw,noexec,relatime,seclabel,data=ordered)
/dev/sda10 on /usr/tideway type ext4 (rw,relatime,seclabel,data=ordered)
/dev/sda8 on /var/log type ext4 (rw,noexec,relatime,seclabel,data=ordered)
/dev/sda9 on /var/log/audit type ext4 (rw,noexec,relatime,seclabel,data=ordered)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=388172k,mode=700,uid=1000,gid=1000)
/dev/sdb2 on /mnt/addm/db_data type ext4 (rw)
[tideway@testhost ~]$Start the tideway services:
[tideway@localhost] $ sudo /bin/systemctl start omniNames
[tideway@localhost] $ sudo /bin/systemctl start cluster
[tideway@localhost] $ tw_service_control --start
Starting local BMC Discovery application services
Starting Security service: [ OK ]
Starting Model service: [ OK ]
Starting Vault service: [ OK ]
Starting Discovery service: [ OK ]
Starting Mainframe Provider service: [ OK ]
Starting SQL Provider service: [ OK ]
Starting CMDB Sync (Exporter) service: [ OK ]
Starting CMDB Sync (Transformer) service: [ OK ]
Starting Reasoning service: [ OK ]
Starting Tomcat: [ OK ]
Starting Reports service: [ OK ]
Starting External API service: [ OK ]
Starting Application Server service: [ OK ]
Updating cron tables: [ OK ]
Updating baseline: [ OK ]
[tideway@testhost ~]$Log on to the Discovery UI. If the UI is available and not showing any errors then re-enable the cluster and omniNames services on startup.
[tideway@testhost ~] $ sudo /bin/systemctl enable cluster
[tideway@testhost ~] $ sudo /bin/systemctl enable omniNames
[tideway@testhost ~] $- Finally, reboot the appliance.