1.1 Devices
You can see which disk devices are available on your host by listing them using the ls command.
$ ls -l /dev/sd*
The actual device file name consists of the prefix sd and a letter indicating which disk it belongs to. The first detected disk is sda, the second is sdb, the third is sdc, and so on. Finally, each partition on the disk gets its own device node as well, and the partition number is the final part of the name. This means that sda1 is the first partition on disk sda, sdb2 is the second partition on disk sdb, and so on. We’ll discuss partitions shortly.
1.2 Partitions
1.3 using your File System
1.3.1 Automating Mounts
Each partition you want to mount automatically at startup needs to be listed in the /etc/fstab file.
#
# /etc/fstab
# Created by anaconda on Sun Aug 14 02:56:30 2011
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=7d014851-6087-4d10-ac52-22bdc850d49a / ext4 defaults 1 1
UUID=62cfa358-911e-4719-a6b6-698eacaa47a4 /boot ext4 defaults 1 2
UUID=3f8a5e7e-cd61-428c-a5e5-2154be503249 /home ext4 defaults 1 2
UUID=7551321b-8375-414f-8812-66d000efc33a swap swap defaults 0 0
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
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/sda1 /var/samba ext3 defaults 0 0 --追加的partition
You can specify a comma‑ separated list of types to try, as is the case with the DVD‑ ROM drive, /dev/scd0. This tries the udf DVD file system first and then iso9660, which is used by CD‑ ROMs.
To add your new partition, you will need to know its UUID. You can find this in the tune2fs listing, or you can use the blkid utility. If you run the latter without any parameters, it prints the UUID for all detected block devices
[root@hadoop-master ~]# blkid
/dev/sda1: UUID="62cfa358-911e-4719-a6b6-698eacaa47a4" TYPE="ext4"
/dev/sda2: UUID="7d014851-6087-4d10-ac52-22bdc850d49a" TYPE="ext4"
/dev/sda3: UUID="7551321b-8375-414f-8812-66d000efc33a" TYPE="swap"
/dev/sda5: UUID="3f8a5e7e-cd61-428c-a5e5-2154be503249" TYPE="ext4"
To mount your ext4 partition with the default mount options, add the following line to the /etc/fstab file:
UUID=
62cfa358-911e-4719-a6b6-698eacaa47a4 /mnt/data ext4 defaults 0 0
If you want to use the device node instead, you can add this:
/dev/sda1 /mnt/data ext4 defaults 0 0
Now you can test this entry without the need to reboot. If you use the mount command and only pass the mount point as a parameter, it will check the /etc/fstab file for a matching entry and mount that, with the options specified in the file:
$ sudo mount /mnt/data
You can double‑ check that the file system is mounted by running the mount command without any parameters, which will list all mounted file systems on the host
$ mount
1.3.2 Checking File System Usage
- $ df -h
- $ du -sh /etc
没有评论:
发表评论