this post was submitted on 19 Oct 2023
39 points (93.3% liked)

Linux

47952 readers
2565 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

A moment ago I unmounted my 1TB HDD with 400GB of content and I partition it into two different partitions, obviously keeping the space that was already occupied. I did because I don't care if the content get corrupted, but after I did it everything is still working perfectly, when I thought everything would be corrupted.

I am possibly a complete ignorant on this subject, but due to the nature of the HDD and how it writes and reads data I expected it to corrupt everything, why didn't it happen? On an SSD on the other hand I would not consider that possible because it is not even a mechanical part where the information is stored.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 1 year ago

Storage media doesn't make a difference here. You can partition a spinning drive, an SSD, NVRAM, phase change storage, hell even magnetic core if you have enough of it.

It also depends on how you did the partitioning. A full partitioning program like gparted will intelligently move and resize partitions. But even if you blindly rewrote a partition table, if you did something like take a 100gb partition, changed it to 50gb, and added a 50gb partition after it, as long as the filesystem has only used that first 50gb, nothing bad will happen. A partition table just says "partition starts here, ends here".

Just look at the output of fdisk:

Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xaf179753

Device     Boot     Start       End   Sectors Size Id Type
/dev/sda1  *         2048 192944127 192942080  92G 83 Linux
/dev/sda2       192944128 209715199  16771072   8G  5 Extended
/dev/sda5       192946176 209715199  16769024   8G 82 Linux swap / Solaris