Change GPT partition file system type with parted

xpt

When I created my GPT partitions using parted, I was using ext2 file system type perviously:

$ parted /dev/sdc print | grep ^12 
12      961GB   1118GB  157GB   ext2               msftdata

Now I want to change it to ext4 instead, so I use mkfs.ext4 /dev/sdc12 to reformat the partition, but when I do a parted /dev/sdc print as above, it is still showing ext2 as the file system type.

I did some reading and seems that the only way for parted to touch the file system type is the mkpartfs command, Ref: http://www.thegeekstuff.com/2011/09/parted-command-examples/. Is that so? I really don't like to use the mkpartfs command to change my file system type because I don't want to recreate my partition again. That will mess up with my partition numbering (sdc12 will be named as sdc19, for e.g.). Is there any better ways?

EDIT:

Bumped into the same problem again, and found the answer here, again, to my very own question. So, logging why I thought it was necessary to change the partition file system type:

% mount $bootdev
mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

% fsck  $bootdev
fsck from util-linux 2.20.1
e2fsck 1.42.8 (20-Jun-2013)
GptLive: clean, 21/1024000 files, 74309/4096000 blocks

% mount $bootdev
mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

I.e., I newly created a /dev/sdb2 entry with type auto in the /etc/fstab. However, mount just can't mount it. However:

% mount $bootdev /mnt/GptLive

% mount | grep $bootdev
/dev/sdb2 on /mnt/GptLive type ext2 (rw)

I.e., when mount $dev doesn't work, mount $dev /mnt/place worked just fine.

I don't know why and can't explain the fix, but just logging the fact that this is why I was looking for the solution, and how I "fixed" it.

Thanks

Rod Smith

The GParted and parted programs give only very limited control over the partition table type code information. At best, some type codes get translated into "flags." That's what the msftdata flag is -- it denotes a Microsoft Basic Data partition (GUID EBD0A0A2-B9E5-4433-87C0-68B6B72699C7; see the Wikipedia list of GPT type codes). You can change some type codes by adjusting flags, but Linux ignores these codes, except for certain limited situations, so on a Linux-only system, you shouldn't need to muck with them. On a dual-boot system, though, you should not set a Linux partition with the Microsoft Basic Data type code; see my page on this topic for details of why this is a bad idea.

The identification of the filesystem as being ext2 in parted is done by the program examining the data within the partition. If you've created a fresh ext4 filesystem in the partition, then parted should be identifying it correctly; but there may be a bug in parted's identification. If so, I wouldn't worry about it. You might want to verify that the partition really does hold an ext4 filesystem by using blkid (as in sudo blkid /dev/sdc12) or by examining the technical details with dumpe2fs -- but the latter requires a fair amount of expertise to interpret. In fact, ext4fs is basically ext2fs with extra features, so telling the two apart can be a bit tricky.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to change GPT partition type on windows?

분류에서Dev

How to edit file system of partition?

분류에서Dev

GPT disk partition recovery

분류에서Dev

Creating partition using parted instead of fdisk

분류에서Dev

Which files are changed when GNU Parted shrinks a partition?

분류에서Dev

How should a RAID partition be created and configured using parted?

분류에서Dev

Is it possible to merge the partition type of EFI System into Linux Filesystem?

분류에서Dev

grub-install: this GPT partition label contains no BIOS Boot Partition

분류에서Dev

Unable to change permissions of file system root

분류에서Dev

Unable to change permissions of file system root

분류에서Dev

Check disk image file system type

분류에서Dev

지원되지 않는 GPT가 감지되었습니다. GNU Parted 사용

분류에서Dev

parted를 사용하는 스크립팅 가능한 GPT 파티션

분류에서Dev

Are GPT reserved and EFI system partitions important?

분류에서Dev

GPT partition table warning message during install of ubuntu

분류에서Dev

How to install Ubuntu on a GPT partition table without using EFI boot?

분류에서Dev

Manual Cloning of a mutli partition gpt disk to smaller target

분류에서Dev

Why do I have MBR and GPT as partition tables?

분류에서Dev

Why can I rest assured that GNU Parted has not corrupted a single bit after shrinking my partition?

분류에서Dev

parted not recognizing my current partition on external disk. How to fix without losing data?

분류에서Dev

How can I reallocate an ext4 file system in an extended partition without lose data?

분류에서Dev

Why is SYSTEM_DRV Partition suddenly being listed in File Explorer Windows 10 Lenovo?

분류에서Dev

Thumbdrive fix? "unable to detect file system" 16GB causes 2GB partition

분류에서Dev

How to change Nautilus to show "file system" instead of "computer"?

분류에서Dev

Why does 'rysnc' change file-system permissions?

분류에서Dev

The password for encrypted file system is not updated when I change the user password

분류에서Dev

System Reserved Partition on wrong drive

분류에서Dev

parted mktable 오류. 그러나 gparted "Create partition table"이 작동합니까?

분류에서Dev

How to determine file system type reliably under Linux?

Related 관련 기사

  1. 1

    How to change GPT partition type on windows?

  2. 2

    How to edit file system of partition?

  3. 3

    GPT disk partition recovery

  4. 4

    Creating partition using parted instead of fdisk

  5. 5

    Which files are changed when GNU Parted shrinks a partition?

  6. 6

    How should a RAID partition be created and configured using parted?

  7. 7

    Is it possible to merge the partition type of EFI System into Linux Filesystem?

  8. 8

    grub-install: this GPT partition label contains no BIOS Boot Partition

  9. 9

    Unable to change permissions of file system root

  10. 10

    Unable to change permissions of file system root

  11. 11

    Check disk image file system type

  12. 12

    지원되지 않는 GPT가 감지되었습니다. GNU Parted 사용

  13. 13

    parted를 사용하는 스크립팅 가능한 GPT 파티션

  14. 14

    Are GPT reserved and EFI system partitions important?

  15. 15

    GPT partition table warning message during install of ubuntu

  16. 16

    How to install Ubuntu on a GPT partition table without using EFI boot?

  17. 17

    Manual Cloning of a mutli partition gpt disk to smaller target

  18. 18

    Why do I have MBR and GPT as partition tables?

  19. 19

    Why can I rest assured that GNU Parted has not corrupted a single bit after shrinking my partition?

  20. 20

    parted not recognizing my current partition on external disk. How to fix without losing data?

  21. 21

    How can I reallocate an ext4 file system in an extended partition without lose data?

  22. 22

    Why is SYSTEM_DRV Partition suddenly being listed in File Explorer Windows 10 Lenovo?

  23. 23

    Thumbdrive fix? "unable to detect file system" 16GB causes 2GB partition

  24. 24

    How to change Nautilus to show "file system" instead of "computer"?

  25. 25

    Why does 'rysnc' change file-system permissions?

  26. 26

    The password for encrypted file system is not updated when I change the user password

  27. 27

    System Reserved Partition on wrong drive

  28. 28

    parted mktable 오류. 그러나 gparted "Create partition table"이 작동합니까?

  29. 29

    How to determine file system type reliably under Linux?

뜨겁다태그

보관