Page MenuHomeDevCentral

Attach a new disk for Mastodon
Closed, ResolvedPublic

Description

The current partition where redis and pgsql are currently hasn't more space disk available.

Yet, hypervisor still has 315.1G available.

Event Timeline

dereckson updated the task description. (Show Details)
dereckson added a project: Servers.

I. Attach a new disk to Dwellers

Stormshear
$ cd /vmfs/volumes/53b61491-b0561938-eec8-0cc47a055d1e/Dwellers
$ vmkfstools -c 200G Mastodon.vmdk
Create: 100% done.
$ vim-cmd vmsvc/getallvms | grep Dwellers
2      Dwellers   [datastore1] Dwellers/Dwellers.vmx   centos64Guest    vmx-08                                                                                                                                                              
$ vim-cmd vmsvc/device.diskaddexisting 2 /vmfs/volumes/53b61491-b0561938-eec8-0cc47a055d1e/Dwellers/Mastodon.vmdk 0 1
Dwellers logs
Jul 11 20:36:03 dwellers.nasqueron.org kernel: vmw_pvscsi: msg type: 0x0 - MSG RING: 1/0 (5) 
Jul 11 20:36:03 dwellers.nasqueron.org kernel: vmw_pvscsi: msg: device added at scsi0:1:0
Jul 11 20:36:03 dwellers.nasqueron.org kernel: scsi 2:0:1:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: [sdb] 419430400 512-byte logical blocks: (214 GB/200 GiB)
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: [sdb] Write Protect is off
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: [sdb] Mode Sense: 61 00 00 00
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: [sdb] Cache data unavailable
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: [sdb] Assuming drive cache: write through
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: Attached scsi generic sg2 type 0
Jul 11 20:36:03 dwellers.nasqueron.org kernel:  sdb: unknown partition table
Jul 11 20:36:03 dwellers.nasqueron.org kernel: sd 2:0:1:0: [sdb] Attached SCSI disk

II. Partition the disk

Dwellers
$ fdisk /dev/sdb
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-419430399, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): 
Using default value 419430399
Partition 1 of type Linux and of size 200 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

III. Add the disk to LVM

Dwellers
$ mkdir /srv/mastodon-data
$ pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
$ vgcreate mastodon /dev/sdb1
  Volume group "mastodon" successfully created
$ lvcreate -l 100%FREE -n mastodon_data mastodon
  Logical volume "mastodon_data" created.
$ mkfs -t xfs /dev/mastodon/mastodon_data 
meta-data=/dev/mastodon/mastodon_data isize=512    agcount=4, agsize=13106944 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=52427776, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=25599, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$ echo "/dev/mapper/mastodon-mastodon_data /srv/mastodon-data xfs defaults 1 2" >> /etc/fstab

Current operation is to move everything to /srv/mastodon-data

Redis cache and PostgreSQL database are done, media attachments are moving (that's slow as there are a lot of small files).

Done, server restarted. /srv/mastodon-data partition uses 33 Gb.

This comment was removed by dereckson.