Skip to content

Commit 8cffe75

Browse files
authored
how to resize drives
1 parent 1171ebd commit 8cffe75

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,35 @@ Other measures
170170

171171
</details>
172172

173+
### Resize Drives / File Systems
174+
175+
Enlarging drives and their partitions seems to work well, even for the root partition of a running system (Debian).
176+
177+
- Take a snapshot of the EBS Volume, wait for it to be completed
178+
- Use "Modify volume" and increase the size
179+
- Increase the partition and file system sizes ([details here](https://docs.aws.amazon.com/ebs/latest/userguide/recognize-expanded-volume-linux.html))
180+
- `sudo growpart /dev/nvme0n1 1` (if there are partitions)
181+
- `sudo resize2fs /dev/nvme0n1p1`
182+
183+
### Recreate Drive
184+
185+
To recreate a drive / file system (to shrink it, or to move to a different file system), create a new EBS volume, mount it and copy the data over using `rsync`.
186+
- new EBS volume, gp3, 400g, default iops/throughput. us-west-1c.
187+
- attach to instance as `/dev/xvdN`
188+
- `lsblk`
189+
- `mkfs -t ext4 -N 50000000 /dev/xvdN` (`-N` to specify the [number of inodes](https://github.com/scala/community-build/issues/1633); `df -hi` to display)
190+
- `mkdir /home/jenkins-new`
191+
- `chown jenkins:root /home/jenkins-new`
192+
- `blkid` to show UUID
193+
- fstab: `UUID=YYYYYYYYYYYYYYYY /home/jenkins-new ext4 noatime 0 0`
194+
- `systemctl daemon-reload`
195+
- `mount -a`
196+
- `chown jenkins:root /home/jenkins-new`
197+
- `rsync -a -H --info=progress2 --info=name0 /home/jenkins/ /home/jenkins-new/`
198+
- `-H` is important, git checkouts use hard links
199+
- fstab, mount new volume at `/home/jenkins`. comment out old volume
200+
- `systemctl daemon-reload`
201+
- `reboot` (old volume might be in use)
173202

174203

175204
### Unattended Upgrades

0 commit comments

Comments
 (0)