I had a VM with a swap partition that I deleted. I now have two primary partitions sda1 and sda2, both ext4. In windows they would be seen as separate drives, but how does linux use these 2 partitions vs one large sda1? My searches just end up talking about how to make partitions or about advantages of partitions.


In practice, they will effectively be used as two separate drives by default, much like in Windows, as you state.

For example, if /dev/sda1 has 50MB free and /dev/sda2 has 50MB free and you try to write a 75MB file to either, it will fail with a disk full error despite both of these partitions being divisions of the same disk.

| improve this answer | |
  • How could I check if a file is on sda1 or sda2? – OrigamiEye Aug 16 '16 at 14:57
  • if you run mount without any arguments it should return "/dev/sda1 on /path/to/mountpoint". So, for example, if /dev/sda1 is mounted on /mnt then every file stored under /mnt will be on /dev/sda1. – I_GNU_it_all_along Aug 16 '16 at 15:03

One partition corresponds to one filesystem or one LVM physical volume (PV). It gets a bit confusing in that one or more PV's combine to form a volume group (VG), which can then be split into zero or more logical volumes (LVs), each LV corresponding to one filesystem or other "disk area" (e.g. swap). Since both your partitions are formatted ext4, the first scenario is applicable, that that each partition is an individual filesystem. The most common arrangement I've seen given that is that sda1 is /boot and sda2 is /, though that's by no means a required mapping.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.