The task arose to increase the size of the disk on a virtuoso with a linux on board. It is not difficult to change the disk size in the settings of the virtual machine, but then it is still necessary to expand the disk by the added volume in the guest system.
This can be done as a bypass, without hemorrhoids to reinstall the system or copy data – tear down everything – put everything back on again..
1. We receive the name of the disc that we will expand:
sudo fdisk -l
Suppose we have this – /dev/sda
2. Let’s go:
3. The fdisk utility uses key commands. It is executed:
- p (print) to see the partition table on the disc. We will see, for example, the /dev/sda1 partition – and we will expand it.
- d (delete) to delete an existing section.
- Then n (new) to create a new one, p for primary, 1 is the section number; and we will indicate the beginning and end of the section in the sectors. The primary sector must correspond to the initial sector of the section that has been removed. Fdisk will usually substitute the correct values by default.
- Once again p – to make sure that the section has now increased to the size we need.
- And w – to record and exit fdisk.
We will then receive a warning that the device is mounted but not available and that the partition volume will be changed after the OS restart.
4. Reboot the car
5. After rebooting, we need to extend the file system to the entire section:
sudo resize2fs /dev/sdb1
We check that the size has changed: