U盘格式ntfs 转ext4

最近试用了一下阿里云的服务器,蛋疼开始选择os的时候选择了windows,发现windows就是个吭,占用资源真大,后来换成linux,但数据盘还是ntfs格式的。然后我就在linux下转换成了ext4 记录一下吧。


[root@fedora15 zou]# fdisk -l
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb532b532

Device Boot Start End Blocks Id System
/dev/sda1 * 63 62926604 31463271 7 HPFS/NTFS/exFAT
/dev/sda2 62926605 488392064 212732730 f W95 Ext'd (LBA)
/dev/sda5 62926668 176184854 56629093+ 7 HPFS/NTFS/exFAT
/dev/sda6 176184918 289443104 56629093+ 7 HPFS/NTFS/exFAT
/dev/sda7 289443168 402701354 56629093+ 7 HPFS/NTFS/exFAT
/dev/sda8 402704384 403728383 512000 83 Linux
/dev/sda9 403730432 488390655 42330112 8e Linux LVM

现在,要把/dev/sda7 ,即F盘的NTFS格式转换成ext4格式,归linux使用。方法:
umount /dev/sda7

用fdisk转换分区格式,改为8e
fdisk /dev/sda
Command (m for help): m (这里有m可以看一下各个参数的意思)
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id //这个t就是偶们要用的
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

下面就是要用t命来修改下分区的id
Command (m for help): t
Partition number (1-10): 7 //这个是分区号
Hex code (type L to list codes):8e // 8e是Linux LVM 的id,可以敲一个“L”查看一下,这样分区的格式就转换完啦。
Command (m for help): w
可以看到/dev/sda7分区

格式化分区:
mkfs.ext4 /dev/sda7

创建/jackzou19目录:
mkdir /data1

挂载分区:
mount /dev/sda7/home/jackzou19
然后挂载好,现在的情况如下:

[root@fedora15 zou]# df -h
 
文件系统 容量 已用 可用 已用%% 挂载点
rootfs 36G 9.6G 25G 29% /
udev 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 2.9M 1.9G 1% /dev/shm
tmpfs 1.9G 732K 1.9G 1% /run
/dev/mapper/vg_fedora15-lv_root
36G 9.6G 25G 29% /
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 1.9G 0 1.9G 0% /media
/dev/sda8 485M 70M 390M 16% /boot
/dev/mapper/vg_fedora15-lv_root
36G 9.6G 25G 29% /tmp
/dev/mapper/vg_fedora15-lv_root
36G 9.6G 25G 29% /var/tmp
/dev/mapper/vg_fedora15-lv_root
36G 9.6G 25G 29% /home
/dev/sda7 54G 180M 51G 1% /home/jackzou19
/dev/sda6 55G 12G 43G 22% /media/Life
/dev/sda5 55G 38G 17G 70% /media/My
/dev/sda1 31G 27G 3.6G 89% /media/Fuck

fuck my life 分别对应这windows系统下的C、D、E盘。

最后设置系统自动加载

[root@fedora15 zou]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Aug 10 09:42:30 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_fedora15-lv_root / ext4 defaults 1 1
UUID=9cdeb21c-7032-431d-acd5-06b49037f86e /boot ext4 defaults 1 2
/dev/mapper/vg_fedora15-lv_swap swap swap defaults 0 0
/dev/sda7 /home/jackzou19 ext4 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0

你可能感兴趣的:(U盘格式ntfs 转ext4)