当前位置: 技术问答>linux和unix
linux磁盘分区问题
来源: 互联网 发布时间:2016-06-08
本文导语: 小弟想把磁盘分成一个分区 不过想用PHP后台程序去磁盘分区 有没有一个命令行 直接分区一个磁盘呀? 小弟想用PHP来调用命令来做磁盘分区 可以吗?求高手解答 | 可以试试命令 parted Part...
小弟想把磁盘分成一个分区
不过想用PHP后台程序去磁盘分区
有没有一个命令行 直接分区一个磁盘呀?
小弟想用PHP来调用命令来做磁盘分区 可以吗?求高手解答
不过想用PHP后台程序去磁盘分区
有没有一个命令行 直接分区一个磁盘呀?
小弟想用PHP来调用命令来做磁盘分区 可以吗?求高手解答
|
可以试试命令 parted
Parted has two modes: command line and interactive. Parted should
always be started with:
# parted DEVICE
where DEVICE is the hard disk device to edit. (If you're lazy and omit
the DEVICE argument, Parted will attempt to guess which device you
want.)
In command line mode, this is followed by one or more commands. For
example:
# parted /dev/sda resize 1 52Mb 104Mb mkfs 2 fat16
Options (like `--help') can only be specified on the command line.
In interactive mode, commands are entered one at a time at a prompt,
and modify the disk immediately. For example:
(parted) resize 1 52.0005Mb 104.5Mb
(parted) mkfs 2 fat16
Unambiguous abbreviations are allowed. For example, you can type "p"
instead of "print", and "resi" instead of "resize". Commands can be
typed either in English, or your native language (if your language has
been translated). This may create ambiguities. Commands are
case-insensitive.
|
不能直接分区的啦,除非你用perl或者是expect交互式语言,不然应该做不到。至少我是只能通过expect和perl来达到如此目的的,lz如果需要的话,我可以给你我以前写的硬盘自动分区的shell脚本,内嵌有expect语言,可以实现自动分区的需求
|
有命令呀,但不知道你的想法是否可行!估计不行。
|
http://soft.yesky.com/os/lin/74/2155574.shtml
|
- -楼上是 Perl - -~~
|
你很难做到,首先,你想怎样获取root权限?
另外,你如何与分区程序交互?
另外,你如何与分区程序交互?