将新分区添加到Centos硬盘

我的硬盘目前有(我相信)2分区; 启动(sda1)和其他一切(sda2?)。 一些硬盘也被用作交换内存,但是我并不真正理解这种效果如何。 服务器是物理的,我有一个LiveCD。

如何将新分区(1 MB,ext3)添加到硬盘,并使sda2更小以容纳新分区?

任何关于lvm,/ dev / mapper,dm-0和dm-1如何应用的附加评论都将会被赞赏,但不是必需的。

谢谢

[root@desktop ~]# mount /dev/mapper/vg_desktop-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) [root@desktop ~]# fdisk -l /dev/sda Disk /dev/sda: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00056f9a Device Boot Start End Blocks Id System /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 182402 1464625152 8e Linux LVM [root@desktop ~]# lvdisplay --- Logical volume --- LV Path /dev/vg_desktop/lv_root LV Name lv_root VG Name vg_desktop LV UUID DhBjdq-0UJR-dJjx-bgH6-adGJ-TL43-8DrZR7 LV Write Access read/write LV Creation host, time desktop.xxx.com, 2013-07-01 04:10:19 -0700 LV Status available # open 1 LV Size 1.36 TiB Current LE 356082 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 1024 Block device 253:0 --- Logical volume --- LV Path /dev/vg_desktop/lv_swap LV Name lv_swap VG Name vg_desktop LV UUID mNpyae-UtdA-MzJR-bbEc-D9OA-VPn8-ECMpbq LV Write Access read/write LV Creation host, time desktop.xxx.com, 2013-07-01 04:13:25 -0700 LV Status available # open 1 LV Size 5.83 GiB Current LE 1492 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 1024 Block device 253:1 [root@desktop mapper]# ls -l /dev/mapper total 0 crw-rw----. 1 root root 10, 58 Jul 4 00:37 control lrwxrwxrwx. 1 root root 7 Jul 4 00:37 vg_desktop-lv_root -> ../dm-0 lrwxrwxrwx. 1 root root 7 Jul 4 00:37 vg_desktop-lv_swap -> ../dm-1 [root@desktop mapper]# 

您需要使用lvreduce缩小您的现有组,以便为​​新卷腾出空间。 那么,你可以使用:

lvcreate -L 3G -n <lvname> vg_desktop其中3G是您希望音量的大小。 然后:

mkfs -t ext3 /dev/vg_desktop/<lvname>来格式化它。 最后,用mount -t ext3 /dev/vg_desktop/<lvname> /mnt/somedir