Linux调整磁盘分区大小
来源:互联网 发布:free源码解析 编辑:程序博客网 时间:2024/04/30 08:09
Resize the disk (Linux调整磁盘分区大小)
Resize the partition. Run parted: $ parted
Show the partition list: (parted) print
There should be two partitions; 1 should be a boot partition, about 64MB; the second should be the main partition, about 3.6G
Some Disk Commands of Linux, that you should know:
- sudo df -h Display the FileSystem that you mounted
- sudo fdisk -l Show your disk information that is unmounted or un-parted
Sonictl: Here I didn't see two partitions by print command. but fdisk -l showed me that.
Resize the second partition to use the whole disk: (parted) resizepart 2 32GB
Sonictl: Here you may meet error: "Unrecognized disk label", useselect command to chang the device from "/dev/mmcblk1boot0" to "/dev/mmcble0", then try again.
Close parted: (parted) quit
Reboot to load the updated partition table: $ reboot
Log in as root again, resize the filesystem: $ resize2fs /dev/mmcblk0p2
Now you should have the full capacity of your microSD card available.
for some reason, you may meet: resize2fs: Permission denied to resize filesystem, you can fix this byLink:Manually Resize on Linux PC
======= above seems works well for Lubuntu/ubuntu =======
For most Embedded OS(raspbian/lubuntu/...), ref: Manually resizing the SD card on Raspberry Pi
======== for calculating the Cylinder# ========
Make a new partition with the exact size you got from the block count. Since you cannot enter block size in fdisk, you need to figure out how many cylinders to request. Here is the formula:
(number of needed cylinders) = (number of blocks) / (block size) (block size) = (unit size) / 1024 (unit size) = (number of heads) * (number of sectors/cylinder) * (number of bytes/sector)
Consider the following example, where a hard drive has been partitioned into four primary partitions of 1, 2, 4, and 8 cylinders.
disk /dev/sda: 16 heads, 63 sectors, 23361 cylindersUnits = cylinders of 1008 * 512 bytes Device Boot Start End Blocks Id System/dev/sda1 1 2 976+ 83 Linux/dev/sda2 3 5 1512 83 Linux/dev/sda3 6 10 2520 83 Linux/dev/sda4 11 19 4536 83 Linuxfdisk provides the configuration information I need in the head of the output. The unit size is516096 (16 heads *63 sectors/cyl *512 bytes/sector ). The block size is504 ( 516096 / 1024 ). The number of needed cylinders for the second partition is therefore3 (1512 blocks/ 504 ). The partition table shows that this is indeed the case: the first cylinder is3, the second4, and the last is5, for a total of three cylinders. The number of needed cylinders for the third partition is calculated similarly:2520 blocks / 504 = 5, which corresponds to blocks6,7,8,9,10 . Notice that this calculation does not work for the first partition because the block count is wrong (976 instead of 1008 ). The plus sign indicates that not all the blocks are included in the fdisk value. When you try the calculation (976 / 504 ) you get1.937. Knowing that the number of cylinders must be an integer, you can simply round up.
- 调整Linux磁盘分区大小
- 调整Linux磁盘分区大小
- Linux调整磁盘分区大小
- 如何调整Linux磁盘分区的大小
- 怎么调整磁盘分区的大小
- windows server 2003中调整磁盘分区大小
- windows server 2003中调整磁盘分区大小
- PQMagic调整磁盘分区容量大小【非格式化硬盘调整】
- 如何合并磁盘分区 windows7调整分区大小方法
- CentOS无损调整磁盘分区大小的实现方法
- linux调整分区大小
- linux分区大小调整
- linux 调整分区大小
- 调整linux虚拟机硬盘大小
- 调整linux虚拟机硬盘大小
- linux调整lvm分区大小
- linux 调整swap分区大小
- Linux 如何调整虚拟内存大小
- tomcat 进程意外退出
- linux重定向及nohup不输出的方法
- python2字符编码问题总结
- List去重
- unity GearVr打包
- Linux调整磁盘分区大小
- 1.8多文件程序
- 百度地图工具类
- C#编程启航(一)visual studio 2015 的安装与语言包
- 下载、安装及使用CocoaPods
- CodeForces 711A Bus to Udayland
- 摄像机标定
- 浅谈C/C++ 开发Excel插件之任务窗格
- Paraview 软件学习