参考 http://qingyang.me/2012/ubuntu-1204-automatically-mount-other-partitions-on-system-startup/
root@Ubuntu32:/etc/init.d#
把第二块硬盘sdb的信息加入到 /etc/fstab中,就可以自动挂载
root@Ubuntu32:/etc/init.d# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=7c76f0b7-85c4-4a27-9bf1-b7c2f3d4aa4e / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=0f42e1e0-a4cb-4b88-9d66-3281612cd77c none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
UUID=8767f1c9-3fa5-49ec-b18d-c2c8600abd34 /home/zhangbin/alex ext4 defaults 0 2
root@Ubuntu32:/etc/init.d#
root@Ubuntu32:/etc/init.d# mount -t /dev/sda3 /home/zhangbin/zbhome
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems
mount -l : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
mount -a [-t|-O] ... : mount all stuff from /etc/fstab
mount device : mount device at the known place
mount directory : mount known device here
mount -t type dev dir : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir
or move a subtree:
mount --move olddir newdir
One can change the type of mount containing the directory dir:
mount --make-shared dir
mount --make-slave dir
mount --make-private dir
mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
mount --make-rshared dir
mount --make-rslave dir
mount --make-rprivate dir
mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using -L label or by uuid, using -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say man 8 mount .
=============
这次新增加一个分区
================
挂载一个新增加的分区到一个目录下:
root@Ubuntu32:/etc/init.d# mount -t ext4 /dev/sda3 /home/zhangbin/zbhome
root@Ubuntu32:/etc/init.d#
把这个命令加入到 /etc/rc.local
==============
参考 http://www.blogbus.com/apit-logs/62852260.html
这个文章还介绍了一个mount的封装的py工具:
[sudo] password for zhangbin:
root@Ubuntu32:/home/zhangbin# apt-get install mountpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
mountpy
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 12.4 kB of archives.
After this operation, 98.3 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/universe mountpy i386 0.8.1 [12.4 kB]
Fetched 12.4 kB in 0s (21.8 kB/s)
Selecting previously unselected package mountpy.
(Reading database ... 566309 files and directories currently installed.)
Unpacking mountpy (from .../mountpy_0.8.1_i386.deb) ...
Processing triggers for man-db ...
Setting up mountpy (0.8.1) ...
root@Ubuntu32:/home/zhangbin#
root@Ubuntu32:/home/zhangbin#
root@Ubuntu32:/home/zhangbin# mountpy
/dev/sdb seems to be already mounted on /home/zhangbin/alex
/dev/sda3 seems to be already mounted on /home/zhangbin/zbhome
/dev/sda1 seems to be already mounted on /
Found nothing to mount
root@Ubuntu32:/home/zhangbin# gedit /etc/rc.local
root@Ubuntu32:/home/zhangbin#