原来的虚拟机只分配了8G空间,用啊用啊的就满了。怎么办?
于是想过挂载硬盘,但是不太会弄,今天在hover(http://www.hoverlees.com/blog/)的帮助下,搞定了。
1、fdisk -l,看看挂载进来的硬件是什么?
XML/HTML代码
- Disk /dev/sda: 8589 MB, 8589935104 bytes
- 255 heads, 63 sectors/track, 1044 cylinders, total 16777217 sectors
- Units = sectors of 1 * 512512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x0006642a
- Device Boot Start End Blocks Id System
- /dev/sda1 * 2048 499711 248832 83 Linux
- /dev/sda2 501758 16775167 8136705 5 Extended
- /dev/sda5 501760 16775167 8136704 8e Linux LVM
- Disk /dev/sdb: 25.8 GB, 25769803776 bytes
- 255 heads, 63 sectors/track, 3133 cylinders, total 50331648 sectors
- Units = sectors of 1 * 512512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00000000
- Disk /dev/sdb doesn't contain a valid partition table
- Disk /dev/mapper/webserver-root: 7763 MB, 7763656704 bytes
- 255 heads, 63 sectors/track, 943 cylinders, total 15163392 sectors
- Units = sectors of 1 * 512512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00000000
- Disk /dev/mapper/webserver-root doesn't contain a valid partition table
- Disk /dev/mapper/webserver-swap_1: 532 MB, 532676608 bytes
- 255 heads, 63 sectors/track, 64 cylinders, total 1040384 sectors
- Units = sectors of 1 * 512512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00000000
- Disk /dev/mapper/webserver-swap_1 doesn't contain a valid partition table
2、将上面的红色部分的设备先格式化成某一类型的盘,输入:“mkfs.” 然后按TAB,出现:
mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.ext4dev
为了更通用一点,我还是用了Ext3,所以我后来输入:mkfs.ext3 /dev/sdb1,返回:
XML/HTML代码
- mke2fs 1.41.14 (22-Dec-2010)
- Filesystem label=
- OS type: Linux
- Block size=4096 (log=2)
- Fragment size=4096 (log=2)
- Stride=0 blocks, Stripe width=0 blocks
- 1572864 inodes, 6291200 blocks
- 314560 blocks (5.00%) reserved for the super user
- First data block=0
- Maximum filesystem blocks=0
- 192 block groups
- 32768 blocks per group, 32768 fragments per group
- 8192 inodes per group
- Superblock backups stored on blocks:
- 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
- 4096000
- Writing inode tables: done
- Creating journal (32768 blocks): done
- Writing superblocks and filesystem accounting information: done
- This filesystem will be automatically checked every 32 mounts or
- 180 days, whichever comes first. Use tune2fs -c or -i to override.
3、mount到一个目录下,
XML/HTML代码
- root@webserver:/mnt# mount /dev/sdb1 /mnt
4、然后df看一下结果:
XML/HTML代码
- root@webserver:/mnt# df
- Filesystem 1K-blocks Used Available Use% Mounted on
- /dev/mapper/webserver-root
- 7462608 4930416 2153108 70% /
- udev 246512 4 246508 1% /dev
- tmpfs 101524 576 100948 1% /run
- none 5120 0 5120 0% /run/lock
- none 253808 0 253808 0% /run/shm
- /dev/sda1 233191 154710 66040 71% /boot
- /dev/sdb1 24769916 176196 23335480 1% /mnt
一切就这样的完成了。
做个笔记。。。