I have several partitions on one hard disk. The file system location on the Ubuntu partition is coming to an end. Can I somehow drag free space from one partition to another?

  • 2
    Yes, create a file system on a partition, mount it somewhere, and use it to store files. - aleksandr barakin
  • And how is the file system created on the partition? - faoxis
  • one
    as usual: $ sudo mkfs -t тип раздел - aleksandr barakin

2 answers 2

due to the fact that the question is very general , and the implementation options are somewhat more than one, I will only give a general description of the most popular options, without detailed instructions for implementing each of these options.

  1. probably the best option, but you probably missed it - using lvm . if the partition where the file system is currently in use would be used as a logical volume during the installation, you could add any (free) partition of the disk (or even the entire disk) to the same with the help of simple manipulations volume group ( pvcreate + vgextend ), increase the size of the volume ( lvextend ), and then the size of the file system ( resize2fs ) right on the running system. instructions on this subject - a huge amount. for example .
  2. to merge file systems located on different partitions (the same or even different disks), you can use the features of the mhddfs program from the package of the same name. an example .
  3. well, you can just mount ( mount ) the file system created ( mkfs ) on the partition, to some suitable place, and store files there.
    1. as a “sub-option”, it is worth mentioning transferring the contents of a directory (for example, /home ) to a file system created on an unused partition, followed by auto-mounting this file system into this (turned empty after transfer) directory. this is usually done on a non-working system (i.e., it is necessary to boot from some live-media, which, for example, is the installation disk of any popular distribution kit). although it is possible and "live": one of many examples .

    You can resize partitions and file systems with gparted . To have the full ability to change the partition, you need to unmount the FS, so to change the root partition, it is better to boot from live-USB, for example, with the installation ubuntu in the "without installation" mode. If space is added to the ext4 file system at the end, then the file system allows you to change its size on the fly.

    When adding space to the beginning of a partition, gparted moves the FS to this number of blocks, and then adds blocks to the end of the FS. There should be careful if it is bootable: after all the changes will need to reinstall the bootloader!