外面的雪花无忧无虑地飘在这小寒的时节里
这个周六就腊八了
天色渐渐暗了下去
噼里啪啦的键盘声鼠标声一如往昔
不断
我还是先加块儿硬盘吧, 我的虚机没空间了。
说干就干
开VirtualBox, 给虚机(Open SUSE Linux 10.2, 上篇博文有提到) )加一个4G硬盘
用Putty登录虚机
loginas: root
Authenticating with public key "rsa-key-20130110 luwenwu@cn.ibm.com" from agent
# 虚拟机嘛, 就是用来糟蹋的, root 登录, 坚决不用密码, 可劲rm.. 因为这个是我clone滴, 嘿嘿
Last login: Tue Jan 15 02:43:37 2013 from 192.168.56.1
Have a lot of fun...
linux-ig872:~ #
先用fdisk看看目前怎么个情况。 以下也给出了详细的命令输出, 给偷懒的同学看的。 不喜欢的直接看粗体的就行了。
linux-ig872:~ # fdisk -l
Disk /dev/sda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 262 2104483+ 82 Linux swap / Solaris
/dev/sda2 * 263 1062 6426000 83 Linux
/dev/sda3 1063 2088 8241345 83 Linux
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 83 Linux
#就这个了, 刚新加的硬盘, 还没有分区, 当然更没有格式化了。
Disk /dev/sdc: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
# 开始用fdisk分区
linux-ig872:~ # fdisk /dev/sdc
Command (m for help): n #新建分区
Command action
e extended
p primary partition (1-4)
p #主分区
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522
Command (m for help): p #打印出来看看
Disk /dev/sdc: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 522 4192933+ 83 Linux #到这里分区已经完成
Command (m for help): w #写入分区表, 就是保存呗
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#不格式化怎么行
linux-ig872:~ # mkfs.ext3 /dev/sdc1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
524288 inodes, 1048233 blocks
52411 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information:
done
# 看看块儿文件
linux-ig872:~ # blkid
/dev/sda1: TYPE="swap"
/dev/sda2: UUID="63b46d8e-a27a-4876-9edb-3fb2b157d962" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda3: UUID="75a0986b-9127-4d19-9a51-a32a6d6bc73c" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb1: UUID="4247c594-c3e3-4825-bdad-860abfd192f6" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdc1: UUID="014ded3a-f0c8-43a7-9697-81220c366f0b" SEC_TYPE="ext2" TYPE="ext3"
# 看看fstab
linux-ig872:~ # cat /etc/fstab
/dev/sda2 / ext3 acl,user_xattr 1 1
/dev/sda3 /home ext3 acl,user_xattr 1 2
/dev/sda1 swap swap defaults 0 0
/dev/sdb1 /opt ext3 acl,user_xattr 0 0
# 先挖个坑, 一会儿把新分区mount过来
linux-ig872:/ # mkdir /bkup
# 懒人都这么干, 一劳永逸, 必须改fstab, 以后重启就不用mount了
linux-ig872:/ # vi /etc/fstab
# 在里面新加一行哦
/dev/sdc1 /bkup ext3 acl,user_xattr 0 0
# 把fstab里的东西都给我mount一遍
linux-ig872:/ # mount -a
# 好了, df 看看, 准备收工了
linux-ig872:/ # df
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 6321524 2390628 3609596 40% / udev 1038188 124 1038064 1% /dev /dev/sda3 8111996 149508 7550424 2% /home /dev/sdb1 8254240 349148 7485800 5% /opt /dev/sdc1 4127076 73792 3843640 2% /bkup