day6
fdisk
# fdisk -l
# fdisk /dev/hda
Command (m for help): m 回车
Command (m for help): p 回车
添加第一个分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-177536, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-177536, default 177536):+1G 回车(+大小)
Command (m for help): p
Disk /dev/hda: 85.8 GB, 85899345920 bytes
15 heads, 63 sectors/track, 177536 cylinders
Units = cylinders of 945 * 512 = 483840 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 2068 977098+ 83 Linux
添加第二个分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (2069-177536, default 2069):
Using default value 2069
Last cylinder or +size or +sizeM or +sizeK (2069-177536, default 177536): +2G
Command (m for help):
添加第三个分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (6204-177536, default 6204):
Using default value 6204
Last cylinder or +size or +sizeM or +sizeK (6204-177536, default 177536): +3G
Command (m for help):
添加扩展分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (12405-177536, default 12405):
Using default value 12405
Last cylinder or +size or +sizeM or +sizeK (12405-177536, default 177536):
Using default value 177536
Command (m for help): n
First cylinder (12405-177536, default 12405):
Using default value 12405
Last cylinder or +size or +sizeM or +sizeK (12405-177536, default 177536): +4G
Command (m for help): w
# partprobe /dev/hda
[root@teacher ~]# ls /dev/hda*
/dev/hda /dev/hda2 /dev/hda4 /dev/hda6
/dev/hda1 /dev/hda3 /dev/hda5 /dev/hda7
[root@teacher ~]# fdisk /dev/hda
Command (m for help): n
First cylinder (31009-177536, default 31009):
Using default value 31009
Last cylinder or +size or +sizeM or +sizeK (31009-177536, default 177536): +1G
Command (m for help): p
Disk /dev/hda: 85.8 GB, 85899345920 bytes
15 heads, 63 sectors/track, 177536 cylinders
Units = cylinders of 945 * 512 = 483840 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 2068 977098+ 83 Linux
/dev/hda2 2069 6203 1953787+ 83 Linux
/dev/hda3 6204 12404 2929972+ 83 Linux
/dev/hda4 12405 177536 78024870 5 Extended
/dev/hda5 12405 20672 3906598+ 83 Linux
/dev/hda6 20673 26873 2929941 83 Linux
/dev/hda7 26874 31008 1953756 83 Linux
/dev/hda8 31009 33076 977098+ 83 Linux
Command (m for help): w
# ls /dev/hda*
# partprobe /dev/hda
# ls /dev/hda*
----------------
# mkfs.ext3 /dev/hda1
# mkfs.ext3 /dev/hda2
# mkfs.ext3 /dev/hda3
# mkfs.ext3 /dev/hda5
# mkfs.ext3 /dev/hda6
# mkfs.ext3 /dev/hda7
# mkdir /mnt/{hda1,hda2,hda3,hda5,hda6,hda7}
# ls /mnt
cdrom hda1 hda2 hda3 hda5 hda6 hda7 hgfs
# mount /dev/hda1 /mnt/hda1
# df -h
-------------------
/etc/fstab
# vim /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/home /home ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/dev/hda9 /newp ext3 defaults 0 0
/dev/hda10 /newp/p1 ext3 defaults 0 0
/dev/hda11 /newp/p1/p2 ext3 defaults 0 0
/dev/hda12 /newp/p1/p2/p3 ext3 defaults 0 0
--------------------
根据uuid 挂载
# blkid /dev/hda12
/dev/hda12: UUID="b1c95ed3-f6b5-4a91-89ac-4b04828f7c50" SEC_TYPE="ext2" TYPE="ext3"
# vim /etc/fstab
UUID="b1c95ed3-f6b5-4a91-89ac-4b04828f7c50" /newp/p1/p2/p3 ext3 defaults 0 0
# mount [-t filesystem] [-o option] device mount_point
# updatedb
# locate *.iso
/rhel5.5.iso
# mount -t iso9660 -o loop /rhel5.5.iso /mnt/iso
mount: mount point /mnt/iso does not exist
# mkdir /mnt/iso
# mount -t iso9660 -o loop /rhel5.5.iso /mnt/iso
----------------
# parted
(parted) help 回车
(parted) print 回车
(parted) mkpart 回车
Partition type? [logical]?
File system type? [ext2]?
Start? 20.5GB
End? 21.5GB
(parted)
创建文件系统
(parted) mkfs
Warning: The existing file system will be destroyed and all data on the partition will be lost. Do
you want to continue?
Yes/No? Yes 回车
Partition number? 13
File system? [ext2]? 回车
(parted)
--------------
进程
# ps aux |less
# ps aux |less
# ps aux |grep vim
root 13310 0.1 0.5 9432 2612 pts/2 S+ 16:37 0:00 vim
# pgrep vim 找出进程号