0

I've been Googling about, and it seems the answer is 'no' from anecdotal reports for gparted. However does this apply to parted as well?

I'm not talking about risk factors here involved by inputting the wrong partition, fat fingering a button, power cuts etc - I mean direct effects only.

How does parted know how much 'space' is available? I just see the following output:

GNU Parted 3.2
Using /dev/sdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA OCZ-VERTEX3 (scsi)
Disk /dev/sdd: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  316MB   315MB   primary  ext4
 2      316MB   60.0GB  59.7GB  primary  ext4

While on gparted I see the following (It's showing up with this drive as /dev/sde after a reboot):

enter image description here

It has some functionality to prevent me from 'resizing' the partition to small (and hence prevent data loss - I assume).

  • Do you expect an answer to parted's implementation of the shrinking process specifically or a general explanation regarding ext? – Hermann Feb 4 at 19:32
  • Your question is too vague to give a definitive answer.. However, it is always possible to lose data at the filesystem metalayer using partitioning utilities. – fpmurphy Feb 4 at 19:37
  • @Hermann I was expecting an answer to parted's implementation. – Chris Stryczynski Feb 4 at 20:28
4

gparted and parted may have similar names but they do (very) different things. gparted is a standalone software with a distinct set of features and explicitely not (just) a GUI frontend to parted, even though it's labelled as such in many places.

How does parted know how much 'space' is available?

parted does not know nor care (anymore) in the least about your filesystems. It might display the filesystem type for convenience and orientation of the user only, but there is no filesystem related functionality.

When you grow a partition in parted, the filesystem does not grow along with it. You have to do this yourself. (e.g. resize2fs after growing the partition).

When you shrink a partition in parted, you have to make sure beforehand that the filesystem will not take offense. (e.g. resize2fs before shrinking the partition).

If you want to move a partition to a different start sector, then parted does nothing to help you with the relocation logic whatsoever. (if you REALLY know what you're doing, you could do this manually, but you probably shouldn't).

Is it possible to lose data with any of these? Yes, of course.

You should always have a backup.

  • gnu.org/software/parted/manual/html_node/parted_32.html#SEC31 "Example: Resizing an ext2 partition on a crowded disk." – sourcejedi Feb 4 at 22:25
  • Yes, that was removed years ago in parted 3.0(?), and the manual is from 2002... you can, of course if you insist, use an old version of parted, I have done so before unix.stackexchange.com/a/373067/30851 and people complain in the comments "not so fast". However even in the old version that functionality is limited and sometimes buggy. It's not what gparted does. – frostschutz Feb 4 at 22:28
  • @frotzschutz thanks, I was hoping you'd offer a citation like that. It is confusing that the official site for parted only has the old out-of-date doc :-). Even just the fact that it shows the names of the different commands in parted is helpful IMO (resizepart, v.s. the resize command that has now been removed). – sourcejedi Feb 4 at 22:32

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.