Chinaunix

标题: 系统盘分区的问题 [打印本页]

作者: wtz_wh    时间: 2015-01-09 12:18
标题: 系统盘分区的问题
我用的KVM虚拟机,里边已经有三个分区
root@host-xxxx:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0    50G  0 disk
©à©¤sda1   8:1    0     7M  0 part
©à©¤sda2   8:2    0  19.1G  0 part /
©¸©¤sda3   8:3    0   896M  0 part [SWAP]

可以看到sda本身是50GB,但是分区里边一共才有20GB。 剩余的磁盘空间怎么才能分配出来呢?

我用fdisk /dev/sda添加了一个/dev/sda4
root@host-xxxx:~# fdisk -l
The number of cylinders for this disk is set to 51200.
This is larger than 1024, and may cause problems with:
1) software that runs at boot time (e.g., LILO)
2) booting and partitioning software form other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Disk /dev/sda: 64 heads, 32 sectors, 51200 cylinders
Units = cylinders of 2048 * 512 bytes

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/sda1            1        1    20480 20971519+  ee  Unknown
Partition 1 does not end on cylinder boundary:
     phys=(1023, 254, 63) should be (1023, 63, 32)
/dev/sda4        20480    20481    51200 31457280    5  Extended

但是我在/dev下面没有看到sda4设备

作者: dengbao2001    时间: 2015-01-09 13:14
磁盘分区的概念你还要熟悉下

除了主分区,还有扩展分区,扩展分区一定要划分逻辑分区才可以

你的sda4是扩展分区,不划分逻辑分区怎么看得到
作者: chenyx    时间: 2015-01-09 13:59
有扩展分区,扩展分区里面没有继续分区,奇怪,你安装的时候怎么分的区啊?
作者: wtz_wh    时间: 2015-01-09 16:44
这个是我从内部系统申请的KVM虚拟机,应该是模板镜像就是这样的,现在的问题是我如何才能使用到剩余的30GB磁盘空间?
回复 3# chenyx


   
作者: linuxzkq    时间: 2015-01-09 17:38
把扩展分区分成逻辑分区就能用了
作者: chenyx    时间: 2015-01-12 08:09
首先,你用df -h和mount命令确认下硬盘的使用情况.
如果正和你说的那样,有未分配空间fdisk将扩展分区添加一个新的分区,比如sda5,格式化挂载就可以使用了
作者: wtz_wh    时间: 2015-01-13 10:20
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        19G   15G  3.7G  80% /
none             64K     0   64K   0% /sys/fs/cgroup
udev            2.0G   64K  2.0G   1% /dev
tmpfs           408M  4.6M  403M   2% /run
none            5.0M     0  5.0M   0% /run/lock
none            2.0G     0  2.0G   0% /run/shm
none            100M     0  100M   0% /run/user

mount
/dev/sda2 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
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)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)

fdisk -l
The number of cylinders for this disk is set to 51200.
This is larger than 1024, and may cause problems with:
1) software that runs at boot time (e.g., LILO)
2) booting and partitioning software form other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Disk /dev/sda: 64 heads, 32 sectors, 51200 cylinders
Units = cylinders of 2048 * 512 bytes

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/sda1            1        1    20480 20971519+  ee  Unknown
Partition 1 does not end on cylinder boundary:
     phys=(1023, 254, 63) should be (1023, 63, 32)
/dev/sda4        20480    20481    51200 31457280   83  Linux native

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0    50G  0 disk
├─sda1   8:1    0     7M  0 part
├─sda2   8:2    0  19.1G  0 part /
└─sda3   8:3    0   896M  0 part [SWAP]

我现在不清楚的是,创建扩展分区/主分区之后,怎样才能使用,是用文件格式化还是要继续分成逻辑分区?LS的有说扩展分区需要继续划分逻辑分区,我不清楚改怎样划分,能告知方法吗?

回复 6# chenyx


   
作者: chenyx    时间: 2015-01-13 19:49
按照目前你提供的信息来看,ext4没有被使用.
你需要用fdisk分区,方法你还是搜索下文档吧.
作者: Shell_HAT    时间: 2015-01-14 10:09
回复 7# wtz_wh


http://linux.vbird.org/linux_basic/0230filesystem.php#fdisk
作者: wtz_wh    时间: 2015-01-14 12:40
谢啦,最后问题解决了,用parted,fdisk貌似不好使

回复 9# Shell_HAT


   
作者: Shell_HAT    时间: 2015-01-14 12:55
回复 10# wtz_wh


    fdisk不支持2TB以上的大分区,parted支持。其实你这个情况用fdisk也是可以的,估计是你还没用习惯




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2