sd卡 格式化 命令 linux,Linux下格式化U盘或者SD卡

前段时间用SD卡刻了用一个Linux系统(存储系统),插在windows下显示只有32MB(原卡16GB的)。好了,问题来了,其他的空间去哪里了呢?

1、如何释放其他未使用的空间?

2、如何重新找回所有空间作为他用呢?

第一个问题的解决办法:

参考我的另一篇文章:《树莓派Raspberry Pi 16G SD卡刷系统时默认空间扩容》

使用gparted图形化工具进行分区扩容。

地址:http://thinkpig007.blog.51cto.com/971471/1334196

第二个问题的解决办法:

当你将此sd插入windows系统下打算格式化,用做他用。可是很悲剧,你右键SD属性,只看到可用空间为32MB,天呐?16GB的空间怎么就剩这么点了呢?你试着想使用windows下的格式化来解决问题,但是当你右键格式化后,可用空间依旧只有32MB,怎么办呢?

这是因为在写入存储系统的时候,硬件将SD重新分区了,你在windows下格式化和看到只是存储系统的一个分区。要把其他空间找回来就需要重新分区(一般SD就分一个分区)。

有两种解决办法:

(1)使用windows PE里面的磁盘分区工具或者单独使用磁盘分区工具

找到SD,将所有分区删除(注意是SD,不要搞错了哦)

(2)使用linux下的fdisk工具来进行重新分区

我的操作过程:

查看当前系统的挂载的分区情况,看到最后的SD分区

root@bt:~# mount

/dev/sda1 on / type ext4 (rw,errors=remount-ro)

proc on /proc type proc (rw,noexec,nosuid,nodev)

none on /sys type sysfs (rw,noexec,nosuid,nodev)

none on /sys/fs/fuse/connections type fusectl (rw)

none on /sys/kernel/debug type debugfs (rw)

none on /sys/kernel/security type securityfs (rw)

none on /dev type devtmpfs (rw,mode=0755)

none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)

none on /dev/shm type tmpfs (rw,nosuid,nodev)

none on /var/run type tmpfs (rw,nosuid,mode=0755)

none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)

none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)

vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock

(rw,nosuid,nodev,default_permissions,allow_other)

/dev/sdb1 on /media/NB_5024_X64 type fuseblk

(rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)

将SD挂载卸载

root@bt:~# umount /dev/sdb1

对SD的分区进行删除

root@bt:~# fdisk /dev/sdb1

WARNING: DOS-compatible mode is deprecated. It's strongly

recommended to

switch off the mode (command 'c') and change display

units to

sectors (command 'u').

Command (m for help): 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

u   change display/entry units

v   verify the partition table

w   write table to disk and exit

x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sdb1: 32 MB, 32868864 bytes

255 heads, 63 sectors/track, 3 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x73736572

This doesn't look like a partition table

Probably you selected the wrong device.

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1p1          119529      232583   908105142   72  Unknown

Partition 1 has different physical/logical beginnings (non-

Linux?):

phys=(80, 13, 10) logical=(119528, 74, 3)

Partition 1 has different physical/logical endings:

phys=(371, 101, 51) logical=(232582, 38, 44)

Partition 1 does not end on cylinder boundary.

/dev/sdb1p2   ?      120513      242122   976826554   6c  Unknown

Partition 2 has different physical/logical beginnings (non-

Linux?):

phys=(357, 43, 4) logical=(120512, 46, 15)

Partition 2 has different physical/logical endings:

phys=(367, 32, 52) logical=(242121, 118, 1)

Partition 2 does not end on cylinder boundary.

/dev/sdb1p3   ?           1           1           0    0  Empty

Partition 3 has different physical/logical beginnings (non-

Linux?):

phys=(0, 10, 0) logical=(0, 0, 1)

Partition 3 has different physical/logical endings:

phys=(0, 0, 0) logical=(267349, 89, 4)

Partition 3 does not end on cylinder boundary.

/dev/sdb1p4            1726        1726         223+   0  Empty

Partition 4 has different physical/logical beginnings (non-

Linux?):

phys=(0, 0, 0) logical=(1725, 158, 44)

Partition 4 has different physical/logical endings:

phys=(0, 0, 0) logical=(1725, 165, 49)

Partition 4 does not end on cylinder boundary.

Command (m for help): d

Command (m for help): p

Disk /dev/sdb1: 32 MB, 32868864 bytes

255 heads, 63 sectors/track, 3 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x73736572

Device Boot      Start         End      Blocks   Id  System

Command (m for help): w

删除完sdb1后,w保存

同样再来对sdb真个设备进行分区删除

root@bt:~# fdisk /dev/sdb——》d——》w,d删除分区,w保存操作退出fdisk

再来看,sdb设备大小,且没有其他分区。

root@bt:~# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000025ee

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1       12518   100548608   83  Linux

/dev/sda2           12518       13055     4305921    5  Extended

/dev/sda5           12518       13055     4305920   82  Linux

swap / Solaris

Disk /dev/sdb: 15.9 GB, 15931539456 bytes

64 heads, 32 sectors/track, 15193 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4f9ae4a3

Device Boot      Start         End      Blocks   Id  System

root@bt:~#

OK搞定,将SD从Linux系统退出,放到windows下格式化为NTFS,可以看到有14.8GB的空间可用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值