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
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] 삭제
몇 마디 만하겠습니다