https://wiki.archlinux.org/api.php?action=feedcontributions&user=Teratomata&feedformat=atom
ArchWiki - User contributions [en]
2024-03-28T19:38:04Z
User contributions
MediaWiki 1.41.0
https://wiki.archlinux.org/index.php?title=ZFS&diff=329618
ZFS
2014-08-10T02:34:42Z
<p>Teratomata: </p>
<hr />
<div>[[Category:File systems]]<br />
{{Related articles start}}<br />
{{Related|File systems}}<br />
{{Related|Experimenting with ZFS}}<br />
{{Related|Installing Arch Linux on ZFS}}<br />
{{Related|ZFS on FUSE}}<br />
{{Related articles end}}<br />
<br />
[[Wikipedia:ZFS|ZFS]] is an advanced filesystem created by [[Wikipedia:Sun Microsystems|Sun Microsystems]] (now owned by Oracle) and released for OpenSolaris in November 2005. Features of ZFS include: pooled storage (integrated volume management -- zpool), [[Wikipedia:Copy-on-write|Copy-on-write]], [[Wikipedia:Snapshot (computer storage)|snapshots]], data integrity verification and automatic repair (scrubbing), [[Wikipedia:RAID-Z|RAID-Z]], a maximum [[Wikipedia:Exabyte|16 Exabyte]] file size, and a maximum [[Wikipedia:Zettabyte|256 Zettabyte]] volume size. ZFS is licensed under the [[Wikipedia:CDDL|Common Development and Distribution License]] (CDDL).<br />
<br />
Described as [http://web.archive.org/web/20060428092023/http://www.sun.com/2004-0914/feature/ "The last word in filesystems"] ZFS is stable, fast, secure, and future-proof. Being licensed under the CDDL, and thus incompatible with GPL, it is not possible for ZFS to be distributed along with the Linux Kernel. This requirement, however, does not prevent a native Linux kernel module from being developed and distributed by a third party, as is the case with [http://zfsonlinux.org/ zfsonlinux.org] (ZOL).<br />
<br />
ZOL is a project funded by the [https://www.llnl.gov/ Lawrence Livermore National Laboratory] to develop a native Linux kernel module for its massive storage requirements and super computers.<br />
<br />
==Installation==<br />
<br />
Install {{AUR|zfs-git}} from the [[Arch User Repository]] or the [[Unofficial user repositories#demz-repo-core|demz-repo-core]] repository. This package has {{AUR|zfs-utils-git}} and {{AUR|spl-git}} as a dependency, which in turn has {{AUR|spl-utils-git}} as dependency. SPL (Solaris Porting Layer) is a Linux Kernel module implementing Solaris APIs for ZFS compatibility.<br />
<br />
{{Note|1=The zfs-git package replaces the original zfs package from [[AUR]]. ZFSonLinux.org is slow to make stable releases and kernel API changes broke stable builds of ZFSonLinux for Arch. Changes submitted to the master branch of the ZFSonLinux repository are regression tested and therefore considered stable.}}<br />
<br />
For users that desire ZFS builds from stable releases, {{AUR|zfs-lts}} is available from the [[Arch User Repository]] or the [[Unofficial user repositories#demz-repo-core|demz-repo-core]] repository.<br />
<br />
{{warning|The ZFS and SPL kernel modules are tied to a specific kernel version. It would not be possible to apply any kernel updates until updated packages are uploaded to AUR or the [[Unofficial user repositories#demz-repo-core|demz-repo-core]] repository.}}<br />
<br />
Test the installation by issuing {{ic|zpool status}} on the command line. If an "insmod" error is produced, try {{ic|depmod -a}}.<br />
<br />
=== Archiso ===<br />
<br />
For installing Arch Linux into a ZFS root filesystem, install {{AUR|zfs-git}} from the [[Arch User Repository]] or the [[Unofficial user repositories#demz-repo-archiso|demz-repo-archiso]] repository.<br />
<br />
See [[Installing Arch Linux on ZFS]] for more information.<br />
<br />
=== Automated build script ===<br />
<br />
The build order of the above is important due to nested dependencies. One can automate the entire process, including downloading the packages with the following shell script. The only requirements for it to work are:<br />
*{{pkg|sudo}} - Note that your user needed sudo rights to {{ic|/usr/bin/clean-chroot-manager}} for the script below to work.<br />
*{{pkg|rsync}} - Needed for moving over the build files.<br />
*{{AUR|cower}} - Needed to grab sources from the AUR.<br />
*{{AUR|clean-chroot-manager}} - Needed to build in a clean chroot and add packages to a local repo.<br />
<br />
Be sure to add the local repo to {{ic|/etc/pacman.conf}} like so:<br />
{{hc|$ tail /etc/pacman.conf|<nowiki><br />
[chroot_local]<br />
SigLevel = Optional TrustAll<br />
Server = file:///path/to/localrepo/defined/below<br />
</nowiki>}}<br />
<br />
{{hc|~/bin/build_zfs|<nowiki><br />
#!/bin/bash<br />
#<br />
# ZFS Builder by graysky<br />
#<br />
<br />
# define the temp space for building here<br />
WORK='/scratch'<br />
<br />
# create this dir and chown it to your user<br />
# this is the local repo which will store your zfs packages<br />
REPO='/var/repo'<br />
<br />
# Add the following entry to /etc/pacman.conf for the local repo<br />
#[chroot_local]<br />
#SigLevel = Optional TrustAll<br />
#Server = file:///path/to/localrepo/defined/above<br />
<br />
for i in rsync cower clean-chroot-manager; do<br />
command -v $i >/dev/null 2>&1 || {<br />
echo "I require $i but it's not installed. Aborting." >&2<br />
exit 1; }<br />
done<br />
<br />
[[ -f ~/.config/clean-chroot-manager.conf ]] &&<br />
. ~/.config/clean-chroot-manager.conf || exit 1<br />
<br />
[[ ! -d "$REPO" ]] &&<br />
echo "Make the dir for your local repo and chown it: $REPO" && exit 1<br />
<br />
[[ ! -d "$WORK" ]] &&<br />
echo "Make a work directory: $WORK" && exit 1<br />
<br />
cd "$WORK"<br />
for i in spl-utils-git spl-git zfs-utils-git zfs-git; do<br />
[[ -d $i ]] && rm -rf $i<br />
cower -d $i<br />
done<br />
<br />
for i in spl-utils-git spl-git zfs-utils-git zfs-git; do<br />
cd "$WORK/$i"<br />
sudo ccm s<br />
done<br />
<br />
rsync -auvxP "$CHROOTPATH/root/repo/" "$REPO"<br />
</nowiki>}}<br />
<br />
==Experimenting with ZFS ==<br />
<br />
Users wishing to experiment with ZFS on ''virtual block devices'' (known in ZFS terms as VDEVs) which can be simple files like {{ic|~/zfs0.img}} {{ic|~/zfs1.img}} {{ic|~/zfs2.img}} etc. with no possibility of real data loss are encouraged to see the [[Experimenting with ZFS]] article. Common tasks like building a RAIDZ array, purposefully corrupting data and recovering it, snapshotting datasets, etc. are covered.<br />
<br />
==Configuration==<br />
<br />
ZFS is considered a "zero administration" filesystem by its creators; therefore, configuring ZFS is very straight forward. Configuration is done primarily with two commands: {{ic|zfs}} and {{ic|zpool}}.<br />
<br />
{{Note|The following section is ONLY needed if users wish to install their root filesystem to a ZFS volume. Users wishing to have a data partition with ZFS do NOT need to read the next section.}}<br />
<br />
===Automatic Start===<br />
<br />
For ZFS to live by its "zero administration" namesake, the zfs daemon must be loaded at startup. A benefit to this is that it is not necessary to mount the zpool in {{ic|/etc/fstab}}; the zfs daemon can import and mount zfs pools automatically. The daemon mounts the zfs pools reading the file {{ic|/etc/zfs/zpool.cache}}.<br />
<br />
For each pool you want automatically mounted by the zfs daemon execute:<br />
# zpool set cachefile=/etc/zfs/zpool.cache <pool><br />
<br />
==Systemd==<br />
<br />
Enable the service so it is automatically started at boot time:<br />
<br />
# systemctl enable zfs.target<br />
<br />
To manually start the daemon:<br />
<br />
# systemctl start zfs.target<br />
<br />
==Create a storage pool==<br />
<br />
Use {{ic| # parted --list}} to see a list of all available drives. It is not necessary nor recommended to partition the drives before creating the zfs filesystem.<br />
<br />
{{Note|If some or all device have been used in a software RAID set it is paramount to erase any old RAID configuration information. (https://wiki.archlinux.org/index.php/Mdadm#Prepare_the_Devices) }}<br />
<br />
{{Warning|For Advanced Format Disks with 4KB sector size, an ashift of 12 is recommended for best performance. Advanced Format disks emulate a sector size of 512 bytes for compatibility with legacy systems, this causes ZFS to sometimes use an ashift option number that is not ideal. Once the pool has been created, the only way to change the ashift option is to recreate the pool. Using an ashift of 12 would also decrease available capacity. See [http://zfsonlinux.org/faq.html#PerformanceConsideration 1.10 What’s going on with performance?], [http://zfsonlinux.org/faq.html#HowDoesZFSonLinuxHandlesAdvacedFormatDrives 1.15 How does ZFS on Linux handles Advanced Format disks?], and [http://wiki.illumos.org/display/illumos/ZFS+and+Advanced+Format+disks ZFS and Advanced Format disks].}}<br />
<br />
Having identified the list of drives, it is now time to get the id's of the drives to add to the zpool. The [http://zfsonlinux.org/faq.html#WhatDevNamesShouldIUseWhenCreatingMyPool zfs on Linux developers recommend] using device ids when creating ZFS storage pools of less than 10 devices. To find the id's, simply:<br />
<br />
$ ls -lah /dev/disk/by-id/<br />
<br />
The ids should look similar to the following:<br />
<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0JKRR -> ../../sdc<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0JTM1 -> ../../sde<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0KBP8 -> ../../sdd<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0KDGY -> ../../sdb<br />
<br />
Now, finally, create the ZFS pool:<br />
<br />
# zpool create -f -m <mount> <pool> raidz <ids><br />
<br />
* '''create''': subcommand to create the pool.<br />
<br />
* '''-f''': Force creating the pool. This is to overcome the "EFI label error". See [[#does not contain an EFI label]].<br />
<br />
* '''-m''': The mount point of the pool. If this is not specified, than the pool will be mounted to {{ic|/<pool>}}.<br />
<br />
* '''pool''': This is the name of the pool.<br />
<br />
* '''raidz''': This is the type of virtual device that will be created from the pool of devices. Raidz is a special implementation of raid5. See [https://blogs.oracle.com/bonwick/entry/raid_z Jeff Bonwick's Blog -- RAID-Z] for more information about raidz.<br />
<br />
* '''ids''': The names of the drives or partitions that to include into the pool. Get it from {{ic|/dev/disk/by-id}}.<br />
<br />
Here is an example for the full command:<br />
<br />
# zpool create -f -m /mnt/data bigdata raidz ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-9YN166_S1F0JKRR ata-ST3000DM001-9YN166_S1F0KBP8 ata-ST3000DM001-9YN166_S1F0JTM1<br />
<br />
=== Advanced format disks ===<br />
<br />
In case Advanced Format disks are used which have a native sector size of 4096 bytes instead of 512 bytes, the automated sector size detection algorithm of ZFS might detect 512 bytes because the backwards compatibility with legacy systems. This would result in degraded performance. To make sure a correct sector size is used, the {{ic|<nowiki>ashift=12</nowiki>}} option should be used (See the [http://zfsonlinux.org/faq.html#HowDoesZFSonLinuxHandlesAdvacedFormatDrives ZFS on Linux FAQ]). The full command would in this case be:<br />
<br />
# zpool create -f -o ashift=12 -m /mnt/data bigdata raidz ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-9YN166_S1F0JKRR ata-ST3000DM001-9YN166_S1F0KBP8 ata-ST3000DM001-9YN166_S1F0JTM1<br />
<br />
=== Verifying pool creation ===<br />
<br />
If the command is successful, there will be no output. Using the {{ic|$ mount}} command will show that the pool is mounted. Using {{ic|# zpool status}} will show that the pool has been created.<br />
<br />
{{hc|# zpool status|<br />
pool: bigdata<br />
state: ONLINE<br />
scan: none requested<br />
config:<br />
<br />
NAME STATE READ WRITE CKSUM<br />
bigdata ONLINE 0 0 0<br />
-0 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KDGY-part1 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0JKRR-part1 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KBP8-part1 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0JTM1-part1 ONLINE 0 0 0<br />
<br />
errors: No known data errors<br />
}}<br />
<br />
At this point it would be good to reboot the machine to ensure that the ZFS pool is mounted at boot. It is best to deal with all errors before transferring data.<br />
<br />
== Tuning ==<br />
<br />
=== General ===<br />
Many parameters are available for zfs file systems, you can view a full list with <code>zfs get all <pool></code>. Two common ones to adjust are '''atime''' and '''compression'''.<br />
<br />
Atime is enabled by default but for most users, it represents superfluous writes to the zpool and it can be disabled using the zfs command:<br />
# zfs set atime=off <pool><br />
<br />
As an alternative to turning off atime completely, '''relatime''' is available. This brings the default ext4/xfs atime semantics to ZFS, where access time is only updated if the modified time or changed time changes, or if the existing access time has not been updated within the past 24 hours. It is a compromise between atime=off and atime=on. This property ''only'' takes effect if '''atime''' is '''on''':<br />
# zfs set relatime=on <pool><br />
<br />
Compression is just that, transparent compression of data. Consult the man page for various options. A recent advancement is the lz4 algorithm which offers excellent compression and performance. Enable it (or any other) using the zfs command:<br />
# zfs set compression=lz4 <pool><br />
<br />
Other options for zfs can be displayed again, using the zfs command:<br />
# sudo zfs get all <pool><br />
<br />
=== Database ===<br />
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. This can often help fragmentation and file access, at the cost that ZFS would have to allocate new 128KiB blocks each time only a few bytes are written to.<br />
<br />
Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for [[MySQL|MySQL/MariaDB]], [[PostgreSQL]], and [[Oracle]], all three of them use an 8KiB block size ''by default''. For both performance concerns and keeping snapshot differences to a minimum (for backup purposes, this is helpful), it is usually desirable to tune ZFS instead to accommodate the databases, using a command such as:<br />
# zfs set recordsize=8K <pool>/postgres<br />
<br />
These RDBMSes also tend to implement their own caching algorithm, often similar to ZFS's own ARC. In the interest of saving memory, it is best to simply disable ZFS's caching of the database's file data and let the database do its own job:<br />
# zfs set primarycache=metadata <pool>/postgres<br />
<br />
If your pool has no configured log devices, ZFS reserves space on the pool's data disks for its intent log (the ZIL). ZFS uses this for crash recovery, but databases are often syncing their data files to the file system on their own transaction commits anyway. The end result of this is that ZFS will be committing data '''twice''' to the data disks, and it can severely impact performance. You can tell ZFS to prefer to not use the ZIL, and in which case, data is only committed to the file system once. Setting this for non-database file systems, or for pools with configured log devices, can actually ''negatively'' impact the performance, so beware:<br />
# zfs set logbias=throughput <pool>/postgres<br />
<br />
These can also be done at file system creation time, for example:<br />
# zfs create -o recordsize=8K \<br />
-o primarycache=metadata \<br />
-o mountpoint=/var/lib/postgres \<br />
-o logbias=throughput \<br />
<pool>/postgres<br />
<br />
Please note: these kinds of tuning parameters are ideal for specialized applications like RDBMSes. You can easily ''hurt'' ZFS's performance by setting these on a general-purpose file system such as your /home directory.<br />
<br />
=== /tmp ===<br />
If you would like to use ZFS to store your /tmp directory, which may be useful for storing arbitrarily-large sets of files or simply keeping your RAM free of idle data, you can generally improve performance of certain applications writing to /tmp by disabling file system sync. This causes ZFS to ignore an application's sync requests (eg, with <code>fsync</code> or <code>O_SYNC</code>) and return immediately. While this has severe application-side data consistency consequences (never disable sync for a database!), files in /tmp are less likely to be important and affected. Please note this does ''not'' affect the integrity of ZFS itself, only the possibility that data an application expects on-disk may not have actually been written out following a crash.<br />
# zfs set sync=disabled <pool>/tmp<br />
<br />
Additionally, for security purposes, you may want to disable '''setuid''' and '''devices''' on the /tmp file system, which prevents some kinds of privilege-escalation attacks or the use of device nodes:<br />
# zfs set setuid=off <pool>/tmp<br />
# zfs set devices=off <pool>/tmp<br />
<br />
Combining all of these for a create command would be as follows:<br />
# zfs create -o setuid=off -o devices=off -o sync=disabled -o mountpoint=/tmp <pool>/tmp<br />
<br />
Please note, also, that if you want /tmp on ZFS, you will need to mask (disable) [[systemd]]'s automatic tmpfs-backed /tmp, else ZFS will be unable to mount your dataset at boot-time or import-time:<br />
# systemctl mask tmp.mount<br />
<br />
=== zvols ===<br />
zvols might suffer from the same block size-related issues as RDBMSes, but it's worth noting that the default recordsize for zvols is 8KiB already. If possible, it is best to align any partitions contained in a zvol to your recordsize (current versions of fdisk and gdisk by default automatically align at 1MiB segments, which works), and file system block sizes to the same size. Other than this, you might tweak the '''recordsize''' to accommodate the data inside the zvol as necessary (though 8KiB tends to be a good value for most file systems, even when using 4KiB blocks on that level).<br />
<br />
== Usage ==<br />
<br />
Users can optionally create a dataset under the zpool as opposed to manually creating directories under the zpool. Datasets allow for an increased level of control (quotas for example) in addition to snapshots. To be able to create and mount a dataset, a directory of the same name must not pre-exist in the zpool. To create a dataset, use:<br />
<br />
# zfs create <nameofzpool>/<nameofdataset><br />
<br />
It is then possible to apply ZFS specific attributes to the dataset. For example, one could assign a quota limit to a specific directory within a dataset:<br />
<br />
# zfs set quota=20G <nameofzpool>/<nameofdataset>/<directory><br />
<br />
To see all the commands available in ZFS, use :<br />
<br />
$ man zfs<br />
<br />
or:<br />
<br />
$ man zpool<br />
<br />
=== Scrub ===<br />
<br />
ZFS pools should be scrubbed at least once a week. To scrub the pool:<br />
<br />
# zpool scrub <pool><br />
<br />
To do automatic scrubbing once a week, set the following line in the root crontab:<br />
<br />
{{hc|# crontab -e|<br />
...<br />
30 19 * * 5 zpool scrub <pool><br />
...<br />
}}<br />
<br />
Replace {{ic|<pool>}} with the name of the ZFS pool.<br />
<br />
=== Check zfs pool status ===<br />
<br />
To print a nice table with statistics about the ZFS pool, including and read/write errors, use<br />
<br />
# zpool status -v<br />
<br />
=== Destroy a storage pool ===<br />
<br />
ZFS makes it easy to destroy a mounted storage pool, removing all metadata about the ZFS device. This command destroys any data contained in the pool:<br />
<br />
# zpool destroy <pool><br />
<br />
And now when checking the status:<br />
<br />
{{hc|# zpool status|no pools available}}<br />
<br />
To find the name of the pool, see [[#Check zfs pool status]].<br />
<br />
=== Export a storage pool ===<br />
<br />
If a storage pool is to be used on another system, it will first need to be exported. It is also necessary to export a pool if it has been imported from the archiso as the hostid is different in the archiso as it is in the booted system. The zpool command will refuse to import any storage pools that have not been exported. It is possible to force the import with the {{ic|-f}} argument, but this is considered bad form.<br />
<br />
Any attempts made to import an un-exported storage pool will result in an error stating the storage pool is in use by another system. This error can be produced at boot time abruptly abandoning the system in the busybox console and requiring an archiso to do an emergency repair by either exporting the pool, or adding the {{ic|zfs_force&#61;1}} to the kernel boot parameters (which is not ideal). See [[#On boot the zfs pool does not mount stating: "pool may be in use from other system"]]<br />
<br />
To export a pool,<br />
<br />
# zpool export bigdata<br />
<br />
=== Rename a Zpool ===<br />
Renaming a zpool that is already created is accomplished in 2 steps:<br />
<br />
# zpool export oldname<br />
# zpool import oldname newname<br />
<br />
=== Setting a Different Mount Point ===<br />
The mount point for a given zpool can be moved at will with one command:<br />
# zfs set mountpoint=/foo/bar poolname<br />
<br />
=== Swap volume ===<br />
<br />
ZFS does not allow to use swapfiles, but users can use a ZFS volume (ZVOL) as swap. It is importart to set the ZVOL block size to match the system page size, which can be obtained by the <tt>getconf PAGESIZE</tt> command (default on x86_64 is 4KiB). Other options useful for keeping the system running well in low-memory situations are keeping it always synced and not caching the zvol data.<br />
<br />
Create a 8GiB zfs volume:<br />
<br />
# zfs create -V 8G -b $(getconf PAGESIZE) \<br />
-o primarycache=metadata \<br />
-o sync=always \<br />
-o com.sun:auto-snapshot=false <pool>/swap<br />
<br />
Prepare it as swap partition:<br />
<br />
# mkswap -f /dev/zvol/<pool>/swap<br />
# swapon /dev/zvol/zroot/swap<br />
<br />
To make it permanent, edit {{ic|/etc/fstab}}. ZVOLs support discard, which can potentially help ZFS's block allocator and reduce fragmentation for all other datasets when/if swap is not full.<br />
<br />
Add a line to {{ic|/etc/fstab}}:<br />
<br />
/dev/zvol/<pool>/swap none swap discard 0 0<br />
<br />
Keep in mind the Hibernate hook must be loaded before filesystems, so using ZVOL as swap will not allow to use hibernate function. If you need hibernate, keep a partition for it.<br />
<br />
Make sure to unmount all ZFS filesystems before rebooting the machine, otherwise any ZFS pools will refuse to be imported:<br />
# zfs umount -a<br />
<br />
=== Automatic snapshots ===<br />
<br />
==== ZFS Automatic Snapshot Service for Linux ==== <br />
<br />
The {{AUR|zfs-auto-snapshot-git}} package from [[Arch User Repository|AUR]] provides a shell script to automate the management of snapshots, with each named by date and label (hourly, daily, etc), giving quick and convenient snapshotting of all ZFS datasets. The package also installs cron tasks for quarter-hourly, hourly, daily, weekly, and monthly snapshots. Optionally adjust the --keep parameter from the defaults depending on how far back the snapshots are to go (the monthly script by default keeps data for up to a year).<br />
<br />
To prevent a dataset from being snapshotted at all, set <tt>com.sun:auto-snapshot=false</tt> on it. Likewise, set more fine-grained control as well by label, if, for example, no monthlies are to be kept on a snapshot, for example, set <tt>com.sun:auto-snapshot:monthly=false</tt>.<br />
<br />
==== ZFS Snapshot Manager ====<br />
<br />
The {{AUR|zfs-snap-manager}} package from [[Arch User Repository|AUR]] provides a python service that takes daily snapshots from a configurable set of ZFS datasets and cleans them out in a [http://en.wikipedia.org/wiki/Backup_rotation_scheme#Grandfather-father-son "Grandfather-father-son"] scheme. It can be configured to e.g. keep 7 daily, 5 weekly, 3 monthly and 2 yearly snapshots. <br />
<br />
The package also supports configurable replication to other machines running ZFS by means of {{ic|zfs send}} and {{ic|zfs receive}}. If the destination machine runs this package as well, it could be configured to keep these replicated snapshots for a longer time. This allows a setup where a source machine has only a few daily snapshots locally stored, while on a remote storage server a much longer retention is available.<br />
<br />
==Troubleshooting==<br />
=== ZPool creation fails ===<br />
If the following error occurs then it can be fixed.<br />
<br />
# the kernel failed to rescan the partition table: 16<br />
# cannot label 'sdc': try using parted(8) and then provide a specific slice: -1<br />
<br />
One reason this can occur is because [ZFS expects pool creation to take less than 1 second](https://github.com/zfsonlinux/zfs/issues/2582). This is a reasonable assumption under ordinary conditions, but in many situations it may take longer. Each drive will need to be cleared again before another attempt can be made.<br />
<br />
# parted /dev/sda rm 1<br />
# parted /dev/sda rm 1<br />
# dd if=/dev/zero of=/dev/sdb bs=512 count=1<br />
# zpool labelclear /dev/sda<br />
<br />
A brute force creation can be attempted over and over again, and with some luck the ZPool creation will take less than 1 second.<br />
Once cause for creation slowdown can be slow burst read writes on a drive. By reading from the disk in parallell to ZPool creation, it may be possible to increase burst speeds.<br />
<br />
# dd if=/dev/sda of=/dev/null<br />
<br />
This can be done with multiple drives by saving the above command for each drive to a file on separate lines and running <br />
<br />
# cat $FILE | parallel<br />
<br />
Then run ZPool creation at the same time.<br />
<br />
=== ZFS is using too much RAM ===<br />
<br />
By default, ZFS caches file operations ([[wikipedia:Adaptive replacement cache|ARC]]) using up to two-thirds of available system memory on the host. Remember, ZFS is designed for enterprise class storage systems! To adjust the ARC size, add the following to the [[Kernel parameters]] list:<br />
<br />
zfs.zfs_arc_max=536870912 # (for 512MB)<br />
<br />
For a more detailed description, as well as other configuration options, see [http://wiki.gentoo.org/wiki/ZFS#ARC gentoo-wiki:zfs#arc].<br />
<br />
=== Does not contain an EFI label ===<br />
<br />
The following error will occur when attempting to create a zfs filesystem,<br />
<br />
/dev/disk/by-id/<id> does not contain an EFI label but it may contain partition<br />
<br />
The way to overcome this is to use <code>-f</code> with the zfs create command.<br />
<br />
=== No hostid found ===<br />
<br />
An error that occurs at boot with the following lines appearing before initscript output:<br />
<br />
ZFS: No hostid found on kernel command line or /etc/hostid.<br />
<br />
This warning occurs because the ZFS module does not have access to the spl hosted. There are two solutions, for this. Either place the spl hostid in the [[kernel parameters]] in the boot loader. For example, adding <code>spl.spl_hostid=0x00bab10c</code>.<br />
<br />
The other solution is to make sure that there is a hostid in <code>/etc/hostid</code>, and then regenerate the initramfs image. Which will copy the hostid into the initramfs image.<br />
<br />
# mkinitcpio -p linux<br />
<br />
=== On boot the zfs pool does not mount stating: "pool may be in use from other system" ===<br />
<br />
==== Unexported pool ====<br />
<br />
If the new installation does not boot because the zpool cannot be imported, chroot into the installation and properly export the zpool. See [[ZFS#Emergency chroot repair with archzfs]].<br />
<br />
Once inside the chroot environment, load the ZFS module and force import the zpool,<br />
<br />
# zpool import -a -f<br />
<br />
now export the pool:<br />
<br />
# zpool export <pool><br />
<br />
To see the available pools, use,<br />
<br />
# zpool status<br />
<br />
It is necessary to export a pool because of the way ZFS uses the hostid to track the system the zpool was created on. The hostid is generated partly based on the network setup. During the installation in the archiso the network configuration could be different generating a different hostid than the one contained in the new installation. Once the zfs filesystem is exported and then re-imported in the new installation, the hostid is reset. See [http://osdir.com/ml/zfs-discuss/2011-06/msg00227.html Re: Howto zpool import/export automatically? - msg#00227].<br />
<br />
If ZFS complains about "pool may be in use" after every reboot, properly export pool as described above, and then rebuild ramdisk in normally booted system:<br />
<br />
# mkinitcpio -p linux<br />
<br />
==== Incorrect hostid ====<br />
<br />
Double check that the pool is properly exported. Exporting the zpool clears the hostid marking the ownership. So during the first boot the zpool should mount correctly. If it does not there is some other problem.<br />
<br />
Reboot again, if the zfs pool refuses to mount it means the hostid is not yet correctly set in the early boot phase and it confuses zfs. Manually tell zfs the correct number, once the hostid is coherent across the reboots the zpool will mount correctly.<br />
<br />
Boot using zfs_force and write down the hostid. This one is just an example.<br />
% hostid<br />
0a0af0f8<br />
<br />
This number have to be added to the [[kernel parameters]] as {{ic|spl.spl_hostid&#61;0a0af0f8}}. Another solution is writing the hostid inside the initram image, see the [[Installing Arch Linux on ZFS#After the first boot|installation guide]] explanation about this.<br />
<br />
Users can always ignore the check adding {{ic|zfs_force&#61;1}} in the [[kernel parameters]], but it is not advisable as a permanent solution.<br />
<br />
=== Devices have different sector alignment ===<br />
<br />
Once a drive has become faulted it should be replaced A.S.A.P. with an identical drive.<br />
<br />
# zpool replace bigdata ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-1CH166_W1F478BD -f<br />
<br />
but in this instance, the following error is produced:<br />
<br />
cannot replace ata-ST3000DM001-9YN166_S1F0KDGY with ata-ST3000DM001-1CH166_W1F478BD: devices have different sector alignment<br />
<br />
ZFS uses the ashift option to adjust for physical block size. When replacing the faulted disk, ZFS is attempting to use {{ic|<nowiki>ashift=12</nowiki>}}, but the faulted disk is using a different ashift (probably {{ic|<nowiki>ashift=9</nowiki>}}) and this causes the resulting error. <br />
<br />
For Advanced Format Disks with 4KB blocksize, an ashift of 12 is recommended for best performance. See [http://zfsonlinux.org/faq.html#PerformanceConsideration 1.10 What’s going on with performance?] and [http://wiki.illumos.org/display/illumos/ZFS+and+Advanced+Format+disks ZFS and Advanced Format disks].<br />
<br />
Use zdb to find the ashift of the zpool: {{ic|zdb | grep ashift}}, then use the {{ic|-o}} argument to set the ashift of the replacement drive:<br />
<br />
# zpool replace bigdata ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-1CH166_W1F478BD -o ashift=9 -f<br />
<br />
Check the zpool status for confirmation:<br />
<br />
{{hc|# zpool status -v|<br />
pool: bigdata<br />
state: DEGRADED<br />
status: One or more devices is currently being resilvered. The pool will<br />
continue to function, possibly in a degraded state.<br />
action: Wait for the resilver to complete.<br />
scan: resilver in progress since Mon Jun 16 11:16:28 2014<br />
10.3G scanned out of 5.90T at 81.7M/s, 20h59m to go<br />
2.57G resilvered, 0.17% done<br />
config:<br />
<br />
NAME STATE READ WRITE CKSUM<br />
bigdata DEGRADED 0 0 0<br />
raidz1-0 DEGRADED 0 0 0<br />
replacing-0 OFFLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KDGY OFFLINE 0 0 0<br />
ata-ST3000DM001-1CH166_W1F478BD ONLINE 0 0 0 (resilvering)<br />
ata-ST3000DM001-9YN166_S1F0JKRR ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KBP8 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0JTM1 ONLINE 0 0 0<br />
<br />
errors: No known data errors}}<br />
<br />
== Tips and tricks ==<br />
<br />
===Embed the archzfs packages into an archiso===<br />
<br />
It is a good idea make an installation media with the needed software included. Otherwise, the latest archiso installation media burned to a CD or a USB key is required. <br />
<br />
To embed {{ic|zfs}} in the archiso, from an existing install, download the {{ic|archiso}} package.<br />
<br />
# pacman -S archiso<br />
<br />
Start the process: <br />
# cp -r /usr/share/archiso/configs/releng /root/media<br />
<br />
Edit the {{ic|packages.x86_64}} file adding those lines:<br />
spl-utils-git<br />
spl-git<br />
zfs-utils-git<br />
zfs-git<br />
<br />
Edit the {{ic|pacman.conf}} file adding those lines (TODO, correctly embed keys in the installation media?):<br />
[demz-repo-archiso]<br />
SigLevel = Never<br />
Server = <nowiki>http://demizerone.com/$repo/$arch</nowiki><br />
<br />
Add other packages in {{ic|packages.both}}, {{ic|packages.i686}}, or {{ic|packages.x86_64}} if needed and create the image.<br />
# ./build.sh -v<br />
<br />
The image will be in the {{ic|/root/media/out}} directory.<br />
<br />
More informations about the process can be read in [http://kroweer.wordpress.com/2011/09/07/creating-a-custom-arch-linux-live-usb/ this guide] or in the [[Archiso]] article.<br />
<br />
If installing onto a UEFI system, see [[Unified Extensible Firmware Interface#Create UEFI bootable USB from ISO]] for creating UEFI compatible installation media.<br />
<br />
=== Encryption in ZFS on linux ===<br />
<br />
ZFS on linux does not support encryption directly, but zpools can be created in dm-crypt block devices. Since the zpool is created on the plain-text<br />
abstraction it is possible to have the data encrypted while having all the advantages of ZFS like deduplication, compression, and data robustness.<br />
<br />
dm-crypt, possibly via LUKS, creates devices in {{ic|/dev/mapper}} and their name is fixed. So you just need to change {{ic|zpool create}} commands to<br />
point to that names. The idea is configuring the system to create the {{ic|/dev/mapper}} block devices and import the zpools from there.<br />
Since zpools can be created in multiple devices (raid, mirroring, striping, ...), it is important all the devices are encrypted otherwise the protection<br />
might be partially lost.<br />
<br />
<br />
For example, an encrypted zpool can be created using plain dm-crypt (without LUKS) with:<br />
<br />
# cryptsetup --hash=sha512 --cipher=twofish-xts-plain64 --offset=0 --key-file=/dev/sdZ --key-size=512 open --type=plain /dev/sdX enc<br />
# zpool create zroot /dev/mapper/enc<br />
<br />
In the case of a root filesystem pool, the {{ic|mkinicpio.conf}} HOOKS line will enable the keyboard for the password, create the devices, and load the pools. It will contain something like:<br />
<br />
HOOKS="... keyboard encrypt zfs ..."<br />
<br />
Since the {{ic|/dev/mapper/enc}} name is fixed no import errors will occur.<br />
<br />
Creating encrypted zpools works fine. But if you need encrypted directories, for example to protect your users' homes, ZFS loses some functionality.<br />
<br />
ZFS will see the encrypted data, not the plain-text abstraction, so compression and deduplication will not work. The reason is that encrypted data has always high entropy making compression ineffective and even from the same input you get different output (thanks to salting) making deduplication impossible.<br />
To reduce the unnecessary overhead it is possible to create a sub-filesystem for each encrypted directory and use [[eCryptfs]] on it.<br />
<br />
For example to have an encrypted home: (the two passwords, encryption and login, must be the same)<br />
# zfs create -o compression=off \<br />
-o dedup=off \<br />
-o mountpoint=/home/<username> \<br />
<zpool>/<username><br />
# useradd -m <username><br />
# passwd <username><br />
# ecryptfs-migrate-home -u <username><br />
<log in user and complete the procedure with ecryptfs-unwrap-passphrase><br />
<br />
=== Emergency chroot repair with archzfs ===<br />
<br />
Here is how to use the archiso to get into the ZFS filesystem for maintenance.<br />
<br />
Boot the latest archiso and bring up the network:<br />
<br />
# wifi-menu<br />
# ip link set eth0 up<br />
<br />
Test the network connection:<br />
<br />
# ping google.com<br />
<br />
Sync the pacman package database:<br />
<br />
# pacman -Syy<br />
<br />
(optional) Install a text editor:<br />
<br />
# pacman -S vim<br />
<br />
Add archzfs archiso repository to {{ic|pacman.conf}}:<br />
<br />
{{hc|/etc/pacman.conf|<nowiki><br />
[demz-repo-archiso]<br />
Server = http://demizerone.com/$repo/$arch</nowiki>}}<br />
<br />
Sync the pacman package database:<br />
<br />
# pacman -Syy<br />
<br />
Add the archzfs maintainer's PGP key to the local (installer image) trust:<br />
<br />
# pacman-key --lsign-key 0EE7A126<br />
<br />
Install the ZFS package group:<br />
<br />
# pacman -S archzfs-git<br />
<br />
Load the ZFS kernel modules:<br />
<br />
# modprobe zfs<br />
<br />
Import the pool:<br />
<br />
# zpool import -a -R /mnt<br />
<br />
Mount the boot partitions (if any):<br />
<br />
# mount /dev/sda2 /mnt/boot<br />
# mount /dev/sda1 /mnt/boot/efi<br />
<br />
Chroot into the ZFS filesystem:<br />
<br />
# arch-chroot /mnt /bin/bash<br />
<br />
Check the kernel version:<br />
<br />
# pacman -Qi linux<br />
# uname -r<br />
<br />
uname will show the kernel version of the archiso. If they are different, run depmod (in the chroot) with the correct kernel version of the chroot installation:<br />
<br />
# depmod -a 3.6.9-1-ARCH (version gathered from pacman -Qi linux)<br />
<br />
This will load the correct kernel modules for the kernel version installed in the chroot installation.<br />
<br />
Regenerate the ramdisk:<br />
<br />
# mkinitcpio -p linux<br />
<br />
There should be no errors.<br />
<br />
== See also ==<br />
<br />
* [[Installing Arch Linux on ZFS]]<br />
* [http://zfsonlinux.org/ ZFS on Linux]<br />
* [http://zfsonlinux.org/faq.html ZFS on Linux FAQ]<br />
* [http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/filesystems-zfs.html FreeBSD Handbook -- The Z File System]<br />
* [http://docs.oracle.com/cd/E19253-01/819-5461/index.html Oracle Solaris ZFS Administration Guide]<br />
* [http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide Solaris Internals -- ZFS Troubleshooting Guide]<br />
* [http://royal.pingdom.com/2013/06/04/zfs-backup/ Pingdom details how it backs up 5TB of MySQL data every day with ZFS]<br />
<br />
; Aaron Toponce has authored a 17-part blog on ZFS which is an excellent read.<br />
# [https://pthree.org/2012/12/04/zfs-administration-part-i-vdevs/ VDEVs]<br />
# [https://pthree.org/2012/12/05/zfs-administration-part-ii-raidz/ RAIDZ Levels]<br />
# [https://pthree.org/2012/12/06/zfs-administration-part-iii-the-zfs-intent-log/ The ZFS Intent Log]<br />
# [https://pthree.org/2012/12/07/zfs-administration-part-iv-the-adjustable-replacement-cache/ The ARC]<br />
# [https://pthree.org/2012/12/10/zfs-administration-part-v-exporting-and-importing-zpools/ Import/export zpools]<br />
# [https://pthree.org/2012/12/11/zfs-administration-part-vi-scrub-and-resilver/ Scrub and Resilver]<br />
# [https://pthree.org/2012/12/12/zfs-administration-part-vii-zpool-properties/ Zpool Properties]<br />
# [https://pthree.org/2012/12/13/zfs-administration-part-viii-zpool-best-practices-and-caveats/ Zpool Best Practices]<br />
# [https://pthree.org/2012/12/14/zfs-administration-part-ix-copy-on-write/ Copy on Write]<br />
# [https://pthree.org/2012/12/17/zfs-administration-part-x-creating-filesystems/ Creating Filesystems]<br />
# [https://pthree.org/2012/12/18/zfs-administration-part-xi-compression-and-deduplication/ Compression and Deduplication]<br />
# [https://pthree.org/2012/12/19/zfs-administration-part-xii-snapshots-and-clones/ Snapshots and Clones]<br />
# [https://pthree.org/2012/12/20/zfs-administration-part-xiii-sending-and-receiving-filesystems/ Send/receive Filesystems]<br />
# [https://pthree.org/2012/12/21/zfs-administration-part-xiv-zvols/ ZVOLs]<br />
# [https://pthree.org/2012/12/31/zfs-administration-part-xv-iscsi-nfs-and-samba/ iSCSI, NFS, and Samba]<br />
# [https://pthree.org/2013/01/02/zfs-administration-part-xvi-getting-and-setting-properties/ Get/Set Properties]<br />
# [https://pthree.org/2013/01/03/zfs-administration-part-xvii-best-practices-and-caveats/ ZFS Best Practices]</div>
Teratomata
https://wiki.archlinux.org/index.php?title=ZFS&diff=329617
ZFS
2014-08-10T02:33:40Z
<p>Teratomata: Added ZPool creation failure troublehsooting</p>
<hr />
<div>[[Category:File systems]]<br />
{{Related articles start}}<br />
{{Related|File systems}}<br />
{{Related|Experimenting with ZFS}}<br />
{{Related|Installing Arch Linux on ZFS}}<br />
{{Related|ZFS on FUSE}}<br />
{{Related articles end}}<br />
<br />
[[Wikipedia:ZFS|ZFS]] is an advanced filesystem created by [[Wikipedia:Sun Microsystems|Sun Microsystems]] (now owned by Oracle) and released for OpenSolaris in November 2005. Features of ZFS include: pooled storage (integrated volume management -- zpool), [[Wikipedia:Copy-on-write|Copy-on-write]], [[Wikipedia:Snapshot (computer storage)|snapshots]], data integrity verification and automatic repair (scrubbing), [[Wikipedia:RAID-Z|RAID-Z]], a maximum [[Wikipedia:Exabyte|16 Exabyte]] file size, and a maximum [[Wikipedia:Zettabyte|256 Zettabyte]] volume size. ZFS is licensed under the [[Wikipedia:CDDL|Common Development and Distribution License]] (CDDL).<br />
<br />
Described as [http://web.archive.org/web/20060428092023/http://www.sun.com/2004-0914/feature/ "The last word in filesystems"] ZFS is stable, fast, secure, and future-proof. Being licensed under the CDDL, and thus incompatible with GPL, it is not possible for ZFS to be distributed along with the Linux Kernel. This requirement, however, does not prevent a native Linux kernel module from being developed and distributed by a third party, as is the case with [http://zfsonlinux.org/ zfsonlinux.org] (ZOL).<br />
<br />
ZOL is a project funded by the [https://www.llnl.gov/ Lawrence Livermore National Laboratory] to develop a native Linux kernel module for its massive storage requirements and super computers.<br />
<br />
==Installation==<br />
<br />
Install {{AUR|zfs-git}} from the [[Arch User Repository]] or the [[Unofficial user repositories#demz-repo-core|demz-repo-core]] repository. This package has {{AUR|zfs-utils-git}} and {{AUR|spl-git}} as a dependency, which in turn has {{AUR|spl-utils-git}} as dependency. SPL (Solaris Porting Layer) is a Linux Kernel module implementing Solaris APIs for ZFS compatibility.<br />
<br />
{{Note|1=The zfs-git package replaces the original zfs package from [[AUR]]. ZFSonLinux.org is slow to make stable releases and kernel API changes broke stable builds of ZFSonLinux for Arch. Changes submitted to the master branch of the ZFSonLinux repository are regression tested and therefore considered stable.}}<br />
<br />
For users that desire ZFS builds from stable releases, {{AUR|zfs-lts}} is available from the [[Arch User Repository]] or the [[Unofficial user repositories#demz-repo-core|demz-repo-core]] repository.<br />
<br />
{{warning|The ZFS and SPL kernel modules are tied to a specific kernel version. It would not be possible to apply any kernel updates until updated packages are uploaded to AUR or the [[Unofficial user repositories#demz-repo-core|demz-repo-core]] repository.}}<br />
<br />
Test the installation by issuing {{ic|zpool status}} on the command line. If an "insmod" error is produced, try {{ic|depmod -a}}.<br />
<br />
=== Archiso ===<br />
<br />
For installing Arch Linux into a ZFS root filesystem, install {{AUR|zfs-git}} from the [[Arch User Repository]] or the [[Unofficial user repositories#demz-repo-archiso|demz-repo-archiso]] repository.<br />
<br />
See [[Installing Arch Linux on ZFS]] for more information.<br />
<br />
=== Automated build script ===<br />
<br />
The build order of the above is important due to nested dependencies. One can automate the entire process, including downloading the packages with the following shell script. The only requirements for it to work are:<br />
*{{pkg|sudo}} - Note that your user needed sudo rights to {{ic|/usr/bin/clean-chroot-manager}} for the script below to work.<br />
*{{pkg|rsync}} - Needed for moving over the build files.<br />
*{{AUR|cower}} - Needed to grab sources from the AUR.<br />
*{{AUR|clean-chroot-manager}} - Needed to build in a clean chroot and add packages to a local repo.<br />
<br />
Be sure to add the local repo to {{ic|/etc/pacman.conf}} like so:<br />
{{hc|$ tail /etc/pacman.conf|<nowiki><br />
[chroot_local]<br />
SigLevel = Optional TrustAll<br />
Server = file:///path/to/localrepo/defined/below<br />
</nowiki>}}<br />
<br />
{{hc|~/bin/build_zfs|<nowiki><br />
#!/bin/bash<br />
#<br />
# ZFS Builder by graysky<br />
#<br />
<br />
# define the temp space for building here<br />
WORK='/scratch'<br />
<br />
# create this dir and chown it to your user<br />
# this is the local repo which will store your zfs packages<br />
REPO='/var/repo'<br />
<br />
# Add the following entry to /etc/pacman.conf for the local repo<br />
#[chroot_local]<br />
#SigLevel = Optional TrustAll<br />
#Server = file:///path/to/localrepo/defined/above<br />
<br />
for i in rsync cower clean-chroot-manager; do<br />
command -v $i >/dev/null 2>&1 || {<br />
echo "I require $i but it's not installed. Aborting." >&2<br />
exit 1; }<br />
done<br />
<br />
[[ -f ~/.config/clean-chroot-manager.conf ]] &&<br />
. ~/.config/clean-chroot-manager.conf || exit 1<br />
<br />
[[ ! -d "$REPO" ]] &&<br />
echo "Make the dir for your local repo and chown it: $REPO" && exit 1<br />
<br />
[[ ! -d "$WORK" ]] &&<br />
echo "Make a work directory: $WORK" && exit 1<br />
<br />
cd "$WORK"<br />
for i in spl-utils-git spl-git zfs-utils-git zfs-git; do<br />
[[ -d $i ]] && rm -rf $i<br />
cower -d $i<br />
done<br />
<br />
for i in spl-utils-git spl-git zfs-utils-git zfs-git; do<br />
cd "$WORK/$i"<br />
sudo ccm s<br />
done<br />
<br />
rsync -auvxP "$CHROOTPATH/root/repo/" "$REPO"<br />
</nowiki>}}<br />
<br />
==Experimenting with ZFS ==<br />
<br />
Users wishing to experiment with ZFS on ''virtual block devices'' (known in ZFS terms as VDEVs) which can be simple files like {{ic|~/zfs0.img}} {{ic|~/zfs1.img}} {{ic|~/zfs2.img}} etc. with no possibility of real data loss are encouraged to see the [[Experimenting with ZFS]] article. Common tasks like building a RAIDZ array, purposefully corrupting data and recovering it, snapshotting datasets, etc. are covered.<br />
<br />
==Configuration==<br />
<br />
ZFS is considered a "zero administration" filesystem by its creators; therefore, configuring ZFS is very straight forward. Configuration is done primarily with two commands: {{ic|zfs}} and {{ic|zpool}}.<br />
<br />
{{Note|The following section is ONLY needed if users wish to install their root filesystem to a ZFS volume. Users wishing to have a data partition with ZFS do NOT need to read the next section.}}<br />
<br />
===Automatic Start===<br />
<br />
For ZFS to live by its "zero administration" namesake, the zfs daemon must be loaded at startup. A benefit to this is that it is not necessary to mount the zpool in {{ic|/etc/fstab}}; the zfs daemon can import and mount zfs pools automatically. The daemon mounts the zfs pools reading the file {{ic|/etc/zfs/zpool.cache}}.<br />
<br />
For each pool you want automatically mounted by the zfs daemon execute:<br />
# zpool set cachefile=/etc/zfs/zpool.cache <pool><br />
<br />
==Systemd==<br />
<br />
Enable the service so it is automatically started at boot time:<br />
<br />
# systemctl enable zfs.target<br />
<br />
To manually start the daemon:<br />
<br />
# systemctl start zfs.target<br />
<br />
==Create a storage pool==<br />
<br />
Use {{ic| # parted --list}} to see a list of all available drives. It is not necessary nor recommended to partition the drives before creating the zfs filesystem.<br />
<br />
{{Note|If some or all device have been used in a software RAID set it is paramount to erase any old RAID configuration information. (https://wiki.archlinux.org/index.php/Mdadm#Prepare_the_Devices) }}<br />
<br />
{{Warning|For Advanced Format Disks with 4KB sector size, an ashift of 12 is recommended for best performance. Advanced Format disks emulate a sector size of 512 bytes for compatibility with legacy systems, this causes ZFS to sometimes use an ashift option number that is not ideal. Once the pool has been created, the only way to change the ashift option is to recreate the pool. Using an ashift of 12 would also decrease available capacity. See [http://zfsonlinux.org/faq.html#PerformanceConsideration 1.10 What’s going on with performance?], [http://zfsonlinux.org/faq.html#HowDoesZFSonLinuxHandlesAdvacedFormatDrives 1.15 How does ZFS on Linux handles Advanced Format disks?], and [http://wiki.illumos.org/display/illumos/ZFS+and+Advanced+Format+disks ZFS and Advanced Format disks].}}<br />
<br />
Having identified the list of drives, it is now time to get the id's of the drives to add to the zpool. The [http://zfsonlinux.org/faq.html#WhatDevNamesShouldIUseWhenCreatingMyPool zfs on Linux developers recommend] using device ids when creating ZFS storage pools of less than 10 devices. To find the id's, simply:<br />
<br />
$ ls -lah /dev/disk/by-id/<br />
<br />
The ids should look similar to the following:<br />
<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0JKRR -> ../../sdc<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0JTM1 -> ../../sde<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0KBP8 -> ../../sdd<br />
lrwxrwxrwx 1 root root 9 Aug 12 16:26 ata-ST3000DM001-9YN166_S1F0KDGY -> ../../sdb<br />
<br />
Now, finally, create the ZFS pool:<br />
<br />
# zpool create -f -m <mount> <pool> raidz <ids><br />
<br />
* '''create''': subcommand to create the pool.<br />
<br />
* '''-f''': Force creating the pool. This is to overcome the "EFI label error". See [[#does not contain an EFI label]].<br />
<br />
* '''-m''': The mount point of the pool. If this is not specified, than the pool will be mounted to {{ic|/<pool>}}.<br />
<br />
* '''pool''': This is the name of the pool.<br />
<br />
* '''raidz''': This is the type of virtual device that will be created from the pool of devices. Raidz is a special implementation of raid5. See [https://blogs.oracle.com/bonwick/entry/raid_z Jeff Bonwick's Blog -- RAID-Z] for more information about raidz.<br />
<br />
* '''ids''': The names of the drives or partitions that to include into the pool. Get it from {{ic|/dev/disk/by-id}}.<br />
<br />
Here is an example for the full command:<br />
<br />
# zpool create -f -m /mnt/data bigdata raidz ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-9YN166_S1F0JKRR ata-ST3000DM001-9YN166_S1F0KBP8 ata-ST3000DM001-9YN166_S1F0JTM1<br />
<br />
=== Advanced format disks ===<br />
<br />
In case Advanced Format disks are used which have a native sector size of 4096 bytes instead of 512 bytes, the automated sector size detection algorithm of ZFS might detect 512 bytes because the backwards compatibility with legacy systems. This would result in degraded performance. To make sure a correct sector size is used, the {{ic|<nowiki>ashift=12</nowiki>}} option should be used (See the [http://zfsonlinux.org/faq.html#HowDoesZFSonLinuxHandlesAdvacedFormatDrives ZFS on Linux FAQ]). The full command would in this case be:<br />
<br />
# zpool create -f -o ashift=12 -m /mnt/data bigdata raidz ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-9YN166_S1F0JKRR ata-ST3000DM001-9YN166_S1F0KBP8 ata-ST3000DM001-9YN166_S1F0JTM1<br />
<br />
=== Verifying pool creation ===<br />
<br />
If the command is successful, there will be no output. Using the {{ic|$ mount}} command will show that the pool is mounted. Using {{ic|# zpool status}} will show that the pool has been created.<br />
<br />
{{hc|# zpool status|<br />
pool: bigdata<br />
state: ONLINE<br />
scan: none requested<br />
config:<br />
<br />
NAME STATE READ WRITE CKSUM<br />
bigdata ONLINE 0 0 0<br />
-0 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KDGY-part1 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0JKRR-part1 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KBP8-part1 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0JTM1-part1 ONLINE 0 0 0<br />
<br />
errors: No known data errors<br />
}}<br />
<br />
At this point it would be good to reboot the machine to ensure that the ZFS pool is mounted at boot. It is best to deal with all errors before transferring data.<br />
<br />
== Tuning ==<br />
<br />
=== General ===<br />
Many parameters are available for zfs file systems, you can view a full list with <code>zfs get all <pool></code>. Two common ones to adjust are '''atime''' and '''compression'''.<br />
<br />
Atime is enabled by default but for most users, it represents superfluous writes to the zpool and it can be disabled using the zfs command:<br />
# zfs set atime=off <pool><br />
<br />
As an alternative to turning off atime completely, '''relatime''' is available. This brings the default ext4/xfs atime semantics to ZFS, where access time is only updated if the modified time or changed time changes, or if the existing access time has not been updated within the past 24 hours. It is a compromise between atime=off and atime=on. This property ''only'' takes effect if '''atime''' is '''on''':<br />
# zfs set relatime=on <pool><br />
<br />
Compression is just that, transparent compression of data. Consult the man page for various options. A recent advancement is the lz4 algorithm which offers excellent compression and performance. Enable it (or any other) using the zfs command:<br />
# zfs set compression=lz4 <pool><br />
<br />
Other options for zfs can be displayed again, using the zfs command:<br />
# sudo zfs get all <pool><br />
<br />
=== Database ===<br />
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. This can often help fragmentation and file access, at the cost that ZFS would have to allocate new 128KiB blocks each time only a few bytes are written to.<br />
<br />
Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for [[MySQL|MySQL/MariaDB]], [[PostgreSQL]], and [[Oracle]], all three of them use an 8KiB block size ''by default''. For both performance concerns and keeping snapshot differences to a minimum (for backup purposes, this is helpful), it is usually desirable to tune ZFS instead to accommodate the databases, using a command such as:<br />
# zfs set recordsize=8K <pool>/postgres<br />
<br />
These RDBMSes also tend to implement their own caching algorithm, often similar to ZFS's own ARC. In the interest of saving memory, it is best to simply disable ZFS's caching of the database's file data and let the database do its own job:<br />
# zfs set primarycache=metadata <pool>/postgres<br />
<br />
If your pool has no configured log devices, ZFS reserves space on the pool's data disks for its intent log (the ZIL). ZFS uses this for crash recovery, but databases are often syncing their data files to the file system on their own transaction commits anyway. The end result of this is that ZFS will be committing data '''twice''' to the data disks, and it can severely impact performance. You can tell ZFS to prefer to not use the ZIL, and in which case, data is only committed to the file system once. Setting this for non-database file systems, or for pools with configured log devices, can actually ''negatively'' impact the performance, so beware:<br />
# zfs set logbias=throughput <pool>/postgres<br />
<br />
These can also be done at file system creation time, for example:<br />
# zfs create -o recordsize=8K \<br />
-o primarycache=metadata \<br />
-o mountpoint=/var/lib/postgres \<br />
-o logbias=throughput \<br />
<pool>/postgres<br />
<br />
Please note: these kinds of tuning parameters are ideal for specialized applications like RDBMSes. You can easily ''hurt'' ZFS's performance by setting these on a general-purpose file system such as your /home directory.<br />
<br />
=== /tmp ===<br />
If you would like to use ZFS to store your /tmp directory, which may be useful for storing arbitrarily-large sets of files or simply keeping your RAM free of idle data, you can generally improve performance of certain applications writing to /tmp by disabling file system sync. This causes ZFS to ignore an application's sync requests (eg, with <code>fsync</code> or <code>O_SYNC</code>) and return immediately. While this has severe application-side data consistency consequences (never disable sync for a database!), files in /tmp are less likely to be important and affected. Please note this does ''not'' affect the integrity of ZFS itself, only the possibility that data an application expects on-disk may not have actually been written out following a crash.<br />
# zfs set sync=disabled <pool>/tmp<br />
<br />
Additionally, for security purposes, you may want to disable '''setuid''' and '''devices''' on the /tmp file system, which prevents some kinds of privilege-escalation attacks or the use of device nodes:<br />
# zfs set setuid=off <pool>/tmp<br />
# zfs set devices=off <pool>/tmp<br />
<br />
Combining all of these for a create command would be as follows:<br />
# zfs create -o setuid=off -o devices=off -o sync=disabled -o mountpoint=/tmp <pool>/tmp<br />
<br />
Please note, also, that if you want /tmp on ZFS, you will need to mask (disable) [[systemd]]'s automatic tmpfs-backed /tmp, else ZFS will be unable to mount your dataset at boot-time or import-time:<br />
# systemctl mask tmp.mount<br />
<br />
=== zvols ===<br />
zvols might suffer from the same block size-related issues as RDBMSes, but it's worth noting that the default recordsize for zvols is 8KiB already. If possible, it is best to align any partitions contained in a zvol to your recordsize (current versions of fdisk and gdisk by default automatically align at 1MiB segments, which works), and file system block sizes to the same size. Other than this, you might tweak the '''recordsize''' to accommodate the data inside the zvol as necessary (though 8KiB tends to be a good value for most file systems, even when using 4KiB blocks on that level).<br />
<br />
== Usage ==<br />
<br />
Users can optionally create a dataset under the zpool as opposed to manually creating directories under the zpool. Datasets allow for an increased level of control (quotas for example) in addition to snapshots. To be able to create and mount a dataset, a directory of the same name must not pre-exist in the zpool. To create a dataset, use:<br />
<br />
# zfs create <nameofzpool>/<nameofdataset><br />
<br />
It is then possible to apply ZFS specific attributes to the dataset. For example, one could assign a quota limit to a specific directory within a dataset:<br />
<br />
# zfs set quota=20G <nameofzpool>/<nameofdataset>/<directory><br />
<br />
To see all the commands available in ZFS, use :<br />
<br />
$ man zfs<br />
<br />
or:<br />
<br />
$ man zpool<br />
<br />
=== Scrub ===<br />
<br />
ZFS pools should be scrubbed at least once a week. To scrub the pool:<br />
<br />
# zpool scrub <pool><br />
<br />
To do automatic scrubbing once a week, set the following line in the root crontab:<br />
<br />
{{hc|# crontab -e|<br />
...<br />
30 19 * * 5 zpool scrub <pool><br />
...<br />
}}<br />
<br />
Replace {{ic|<pool>}} with the name of the ZFS pool.<br />
<br />
=== Check zfs pool status ===<br />
<br />
To print a nice table with statistics about the ZFS pool, including and read/write errors, use<br />
<br />
# zpool status -v<br />
<br />
=== Destroy a storage pool ===<br />
<br />
ZFS makes it easy to destroy a mounted storage pool, removing all metadata about the ZFS device. This command destroys any data contained in the pool:<br />
<br />
# zpool destroy <pool><br />
<br />
And now when checking the status:<br />
<br />
{{hc|# zpool status|no pools available}}<br />
<br />
To find the name of the pool, see [[#Check zfs pool status]].<br />
<br />
=== Export a storage pool ===<br />
<br />
If a storage pool is to be used on another system, it will first need to be exported. It is also necessary to export a pool if it has been imported from the archiso as the hostid is different in the archiso as it is in the booted system. The zpool command will refuse to import any storage pools that have not been exported. It is possible to force the import with the {{ic|-f}} argument, but this is considered bad form.<br />
<br />
Any attempts made to import an un-exported storage pool will result in an error stating the storage pool is in use by another system. This error can be produced at boot time abruptly abandoning the system in the busybox console and requiring an archiso to do an emergency repair by either exporting the pool, or adding the {{ic|zfs_force&#61;1}} to the kernel boot parameters (which is not ideal). See [[#On boot the zfs pool does not mount stating: "pool may be in use from other system"]]<br />
<br />
To export a pool,<br />
<br />
# zpool export bigdata<br />
<br />
=== Rename a Zpool ===<br />
Renaming a zpool that is already created is accomplished in 2 steps:<br />
<br />
# zpool export oldname<br />
# zpool import oldname newname<br />
<br />
=== Setting a Different Mount Point ===<br />
The mount point for a given zpool can be moved at will with one command:<br />
# zfs set mountpoint=/foo/bar poolname<br />
<br />
=== Swap volume ===<br />
<br />
ZFS does not allow to use swapfiles, but users can use a ZFS volume (ZVOL) as swap. It is importart to set the ZVOL block size to match the system page size, which can be obtained by the <tt>getconf PAGESIZE</tt> command (default on x86_64 is 4KiB). Other options useful for keeping the system running well in low-memory situations are keeping it always synced and not caching the zvol data.<br />
<br />
Create a 8GiB zfs volume:<br />
<br />
# zfs create -V 8G -b $(getconf PAGESIZE) \<br />
-o primarycache=metadata \<br />
-o sync=always \<br />
-o com.sun:auto-snapshot=false <pool>/swap<br />
<br />
Prepare it as swap partition:<br />
<br />
# mkswap -f /dev/zvol/<pool>/swap<br />
# swapon /dev/zvol/zroot/swap<br />
<br />
To make it permanent, edit {{ic|/etc/fstab}}. ZVOLs support discard, which can potentially help ZFS's block allocator and reduce fragmentation for all other datasets when/if swap is not full.<br />
<br />
Add a line to {{ic|/etc/fstab}}:<br />
<br />
/dev/zvol/<pool>/swap none swap discard 0 0<br />
<br />
Keep in mind the Hibernate hook must be loaded before filesystems, so using ZVOL as swap will not allow to use hibernate function. If you need hibernate, keep a partition for it.<br />
<br />
Make sure to unmount all ZFS filesystems before rebooting the machine, otherwise any ZFS pools will refuse to be imported:<br />
# zfs umount -a<br />
<br />
=== Automatic snapshots ===<br />
<br />
==== ZFS Automatic Snapshot Service for Linux ==== <br />
<br />
The {{AUR|zfs-auto-snapshot-git}} package from [[Arch User Repository|AUR]] provides a shell script to automate the management of snapshots, with each named by date and label (hourly, daily, etc), giving quick and convenient snapshotting of all ZFS datasets. The package also installs cron tasks for quarter-hourly, hourly, daily, weekly, and monthly snapshots. Optionally adjust the --keep parameter from the defaults depending on how far back the snapshots are to go (the monthly script by default keeps data for up to a year).<br />
<br />
To prevent a dataset from being snapshotted at all, set <tt>com.sun:auto-snapshot=false</tt> on it. Likewise, set more fine-grained control as well by label, if, for example, no monthlies are to be kept on a snapshot, for example, set <tt>com.sun:auto-snapshot:monthly=false</tt>.<br />
<br />
==== ZFS Snapshot Manager ====<br />
<br />
The {{AUR|zfs-snap-manager}} package from [[Arch User Repository|AUR]] provides a python service that takes daily snapshots from a configurable set of ZFS datasets and cleans them out in a [http://en.wikipedia.org/wiki/Backup_rotation_scheme#Grandfather-father-son "Grandfather-father-son"] scheme. It can be configured to e.g. keep 7 daily, 5 weekly, 3 monthly and 2 yearly snapshots. <br />
<br />
The package also supports configurable replication to other machines running ZFS by means of {{ic|zfs send}} and {{ic|zfs receive}}. If the destination machine runs this package as well, it could be configured to keep these replicated snapshots for a longer time. This allows a setup where a source machine has only a few daily snapshots locally stored, while on a remote storage server a much longer retention is available.<br />
<br />
==Troubleshooting==<br />
=== ZPool creation fails ===<br />
If the following error occurs then it can be fixed.<br />
<br />
# the kernel failed to rescan the partition table: 16<br />
# cannot label 'sdc': try using parted(8) and then provide a specific slice: -1<br />
<br />
One reason this can occur is because [ZFS expects pool creation to take less than 1 second](https://github.com/zfsonlinux/zfs/issues/2582). This is a reasonable assumption under ordinary conditions, but in many situations it may take longer. Each drive will need to be cleared again before another attempt can be made.<br />
<br />
# parted /dev/sda rm 1<br />
# parted /dev/sda rm 1<br />
# dd if=/dev/zero of=/dev/sdb bs=512 count=1<br />
# zpool labelclear /dev/sda<br />
<br />
A brute force creation can be attempted over and over again, and with some luck the ZPool creation will take less than 1 second.<br />
Once cause for creation slowdown can be slow burst read writes on a drive. By reading from the disk in parallell to ZPool creation, it may be possible to increase burst speeds.<br />
<br />
# dd if=/dev/sda of=/dev/null<br />
<br />
This can be done with multiple drives by saving the above command for each drive to a file on separate lines and running <br />
<br />
# cat $FILE | parallel<br />
<br />
Then run ZPool creation at the same time.<br />
<br />
=== ZFS is using too much RAM ===<br />
<br />
By default, ZFS caches file operations ([[wikipedia:Adaptive replacement cache|ARC]]) using up to two-thirds of available system memory on the host. Remember, ZFS is designed for enterprise class storage systems! To adjust the ARC size, add the following to the [[Kernel parameters]] list:<br />
<br />
zfs.zfs_arc_max=536870912 # (for 512MB)<br />
<br />
For a more detailed description, as well as other configuration options, see [http://wiki.gentoo.org/wiki/ZFS#ARC gentoo-wiki:zfs#arc].<br />
<br />
=== Does not contain an EFI label ===<br />
<br />
The following error will occur when attempting to create a zfs filesystem,<br />
<br />
/dev/disk/by-id/<id> does not contain an EFI label but it may contain partition<br />
<br />
The way to overcome this is to use <code>-f</code> with the zfs create command.<br />
<br />
=== No hostid found ===<br />
<br />
An error that occurs at boot with the following lines appearing before initscript output:<br />
<br />
ZFS: No hostid found on kernel command line or /etc/hostid.<br />
<br />
This warning occurs because the ZFS module does not have access to the spl hosted. There are two solutions, for this. Either place the spl hostid in the [[kernel parameters]] in the boot loader. For example, adding <code>spl.spl_hostid=0x00bab10c</code>.<br />
<br />
The other solution is to make sure that there is a hostid in <code>/etc/hostid</code>, and then regenerate the initramfs image. Which will copy the hostid into the initramfs image.<br />
<br />
# mkinitcpio -p linux<br />
<br />
=== On boot the zfs pool does not mount stating: "pool may be in use from other system" ===<br />
<br />
==== Unexported pool ====<br />
<br />
If the new installation does not boot because the zpool cannot be imported, chroot into the installation and properly export the zpool. See [[ZFS#Emergency chroot repair with archzfs]].<br />
<br />
Once inside the chroot environment, load the ZFS module and force import the zpool,<br />
<br />
# zpool import -a -f<br />
<br />
now export the pool:<br />
<br />
# zpool export <pool><br />
<br />
To see the available pools, use,<br />
<br />
# zpool status<br />
<br />
It is necessary to export a pool because of the way ZFS uses the hostid to track the system the zpool was created on. The hostid is generated partly based on the network setup. During the installation in the archiso the network configuration could be different generating a different hostid than the one contained in the new installation. Once the zfs filesystem is exported and then re-imported in the new installation, the hostid is reset. See [http://osdir.com/ml/zfs-discuss/2011-06/msg00227.html Re: Howto zpool import/export automatically? - msg#00227].<br />
<br />
If ZFS complains about "pool may be in use" after every reboot, properly export pool as described above, and then rebuild ramdisk in normally booted system:<br />
<br />
# mkinitcpio -p linux<br />
<br />
==== Incorrect hostid ====<br />
<br />
Double check that the pool is properly exported. Exporting the zpool clears the hostid marking the ownership. So during the first boot the zpool should mount correctly. If it does not there is some other problem.<br />
<br />
Reboot again, if the zfs pool refuses to mount it means the hostid is not yet correctly set in the early boot phase and it confuses zfs. Manually tell zfs the correct number, once the hostid is coherent across the reboots the zpool will mount correctly.<br />
<br />
Boot using zfs_force and write down the hostid. This one is just an example.<br />
% hostid<br />
0a0af0f8<br />
<br />
This number have to be added to the [[kernel parameters]] as {{ic|spl.spl_hostid&#61;0a0af0f8}}. Another solution is writing the hostid inside the initram image, see the [[Installing Arch Linux on ZFS#After the first boot|installation guide]] explanation about this.<br />
<br />
Users can always ignore the check adding {{ic|zfs_force&#61;1}} in the [[kernel parameters]], but it is not advisable as a permanent solution.<br />
<br />
=== Devices have different sector alignment ===<br />
<br />
Once a drive has become faulted it should be replaced A.S.A.P. with an identical drive.<br />
<br />
# zpool replace bigdata ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-1CH166_W1F478BD -f<br />
<br />
but in this instance, the following error is produced:<br />
<br />
cannot replace ata-ST3000DM001-9YN166_S1F0KDGY with ata-ST3000DM001-1CH166_W1F478BD: devices have different sector alignment<br />
<br />
ZFS uses the ashift option to adjust for physical block size. When replacing the faulted disk, ZFS is attempting to use {{ic|<nowiki>ashift=12</nowiki>}}, but the faulted disk is using a different ashift (probably {{ic|<nowiki>ashift=9</nowiki>}}) and this causes the resulting error. <br />
<br />
For Advanced Format Disks with 4KB blocksize, an ashift of 12 is recommended for best performance. See [http://zfsonlinux.org/faq.html#PerformanceConsideration 1.10 What’s going on with performance?] and [http://wiki.illumos.org/display/illumos/ZFS+and+Advanced+Format+disks ZFS and Advanced Format disks].<br />
<br />
Use zdb to find the ashift of the zpool: {{ic|zdb | grep ashift}}, then use the {{ic|-o}} argument to set the ashift of the replacement drive:<br />
<br />
# zpool replace bigdata ata-ST3000DM001-9YN166_S1F0KDGY ata-ST3000DM001-1CH166_W1F478BD -o ashift=9 -f<br />
<br />
Check the zpool status for confirmation:<br />
<br />
{{hc|# zpool status -v|<br />
pool: bigdata<br />
state: DEGRADED<br />
status: One or more devices is currently being resilvered. The pool will<br />
continue to function, possibly in a degraded state.<br />
action: Wait for the resilver to complete.<br />
scan: resilver in progress since Mon Jun 16 11:16:28 2014<br />
10.3G scanned out of 5.90T at 81.7M/s, 20h59m to go<br />
2.57G resilvered, 0.17% done<br />
config:<br />
<br />
NAME STATE READ WRITE CKSUM<br />
bigdata DEGRADED 0 0 0<br />
raidz1-0 DEGRADED 0 0 0<br />
replacing-0 OFFLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KDGY OFFLINE 0 0 0<br />
ata-ST3000DM001-1CH166_W1F478BD ONLINE 0 0 0 (resilvering)<br />
ata-ST3000DM001-9YN166_S1F0JKRR ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0KBP8 ONLINE 0 0 0<br />
ata-ST3000DM001-9YN166_S1F0JTM1 ONLINE 0 0 0<br />
<br />
errors: No known data errors}}<br />
<br />
== Tips and tricks ==<br />
<br />
===Embed the archzfs packages into an archiso===<br />
<br />
It is a good idea make an installation media with the needed software included. Otherwise, the latest archiso installation media burned to a CD or a USB key is required. <br />
<br />
To embed {{ic|zfs}} in the archiso, from an existing install, download the {{ic|archiso}} package.<br />
<br />
# pacman -S archiso<br />
<br />
Start the process: <br />
# cp -r /usr/share/archiso/configs/releng /root/media<br />
<br />
Edit the {{ic|packages.x86_64}} file adding those lines:<br />
spl-utils-git<br />
spl-git<br />
zfs-utils-git<br />
zfs-git<br />
<br />
Edit the {{ic|pacman.conf}} file adding those lines (TODO, correctly embed keys in the installation media?):<br />
[demz-repo-archiso]<br />
SigLevel = Never<br />
Server = <nowiki>http://demizerone.com/$repo/$arch</nowiki><br />
<br />
Add other packages in {{ic|packages.both}}, {{ic|packages.i686}}, or {{ic|packages.x86_64}} if needed and create the image.<br />
# ./build.sh -v<br />
<br />
The image will be in the {{ic|/root/media/out}} directory.<br />
<br />
More informations about the process can be read in [http://kroweer.wordpress.com/2011/09/07/creating-a-custom-arch-linux-live-usb/ this guide] or in the [[Archiso]] article.<br />
<br />
If installing onto a UEFI system, see [[Unified Extensible Firmware Interface#Create UEFI bootable USB from ISO]] for creating UEFI compatible installation media.<br />
<br />
=== Encryption in ZFS on linux ===<br />
<br />
ZFS on linux does not support encryption directly, but zpools can be created in dm-crypt block devices. Since the zpool is created on the plain-text<br />
abstraction it is possible to have the data encrypted while having all the advantages of ZFS like deduplication, compression, and data robustness.<br />
<br />
dm-crypt, possibly via LUKS, creates devices in {{ic|/dev/mapper}} and their name is fixed. So you just need to change {{ic|zpool create}} commands to<br />
point to that names. The idea is configuring the system to create the {{ic|/dev/mapper}} block devices and import the zpools from there.<br />
Since zpools can be created in multiple devices (raid, mirroring, striping, ...), it is important all the devices are encrypted otherwise the protection<br />
might be partially lost.<br />
<br />
<br />
For example, an encrypted zpool can be created using plain dm-crypt (without LUKS) with:<br />
<br />
# cryptsetup --hash=sha512 --cipher=twofish-xts-plain64 --offset=0 --key-file=/dev/sdZ --key-size=512 open --type=plain /dev/sdX enc<br />
# zpool create zroot /dev/mapper/enc<br />
<br />
In the case of a root filesystem pool, the {{ic|mkinicpio.conf}} HOOKS line will enable the keyboard for the password, create the devices, and load the pools. It will contain something like:<br />
<br />
HOOKS="... keyboard encrypt zfs ..."<br />
<br />
Since the {{ic|/dev/mapper/enc}} name is fixed no import errors will occur.<br />
<br />
Creating encrypted zpools works fine. But if you need encrypted directories, for example to protect your users' homes, ZFS loses some functionality.<br />
<br />
ZFS will see the encrypted data, not the plain-text abstraction, so compression and deduplication will not work. The reason is that encrypted data has always high entropy making compression ineffective and even from the same input you get different output (thanks to salting) making deduplication impossible.<br />
To reduce the unnecessary overhead it is possible to create a sub-filesystem for each encrypted directory and use [[eCryptfs]] on it.<br />
<br />
For example to have an encrypted home: (the two passwords, encryption and login, must be the same)<br />
# zfs create -o compression=off \<br />
-o dedup=off \<br />
-o mountpoint=/home/<username> \<br />
<zpool>/<username><br />
# useradd -m <username><br />
# passwd <username><br />
# ecryptfs-migrate-home -u <username><br />
<log in user and complete the procedure with ecryptfs-unwrap-passphrase><br />
<br />
=== Emergency chroot repair with archzfs ===<br />
<br />
Here is how to use the archiso to get into the ZFS filesystem for maintenance.<br />
<br />
Boot the latest archiso and bring up the network:<br />
<br />
# wifi-menu<br />
# ip link set eth0 up<br />
<br />
Test the network connection:<br />
<br />
# ping google.com<br />
<br />
Sync the pacman package database:<br />
<br />
# pacman -Syy<br />
<br />
(optional) Install a text editor:<br />
<br />
# pacman -S vim<br />
<br />
Add archzfs archiso repository to {{ic|pacman.conf}}:<br />
<br />
{{hc|/etc/pacman.conf|<nowiki><br />
[demz-repo-archiso]<br />
Server = http://demizerone.com/$repo/$arch</nowiki>}}<br />
<br />
Sync the pacman package database:<br />
<br />
# pacman -Syy<br />
<br />
Add the archzfs maintainer's PGP key to the local (installer image) trust:<br />
<br />
# pacman-key --lsign-key 0EE7A126<br />
<br />
Install the ZFS package group:<br />
<br />
# pacman -S archzfs-git<br />
<br />
Load the ZFS kernel modules:<br />
<br />
# modprobe zfs<br />
<br />
Import the pool:<br />
<br />
# zpool import -a -R /mnt<br />
<br />
Mount the boot partitions (if any):<br />
<br />
# mount /dev/sda2 /mnt/boot<br />
# mount /dev/sda1 /mnt/boot/efi<br />
<br />
Chroot into the ZFS filesystem:<br />
<br />
# arch-chroot /mnt /bin/bash<br />
<br />
Check the kernel version:<br />
<br />
# pacman -Qi linux<br />
# uname -r<br />
<br />
uname will show the kernel version of the archiso. If they are different, run depmod (in the chroot) with the correct kernel version of the chroot installation:<br />
<br />
# depmod -a 3.6.9-1-ARCH (version gathered from pacman -Qi linux)<br />
<br />
This will load the correct kernel modules for the kernel version installed in the chroot installation.<br />
<br />
Regenerate the ramdisk:<br />
<br />
# mkinitcpio -p linux<br />
<br />
There should be no errors.<br />
<br />
== See also ==<br />
<br />
* [[Installing Arch Linux on ZFS]]<br />
* [http://zfsonlinux.org/ ZFS on Linux]<br />
* [http://zfsonlinux.org/faq.html ZFS on Linux FAQ]<br />
* [http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/filesystems-zfs.html FreeBSD Handbook -- The Z File System]<br />
* [http://docs.oracle.com/cd/E19253-01/819-5461/index.html Oracle Solaris ZFS Administration Guide]<br />
* [http://www.solarisinternals.com/wiki/index.php/ZFS_Troubleshooting_Guide Solaris Internals -- ZFS Troubleshooting Guide]<br />
* [http://royal.pingdom.com/2013/06/04/zfs-backup/ Pingdom details how it backs up 5TB of MySQL data every day with ZFS]<br />
<br />
; Aaron Toponce has authored a 17-part blog on ZFS which is an excellent read.<br />
# [https://pthree.org/2012/12/04/zfs-administration-part-i-vdevs/ VDEVs]<br />
# [https://pthree.org/2012/12/05/zfs-administration-part-ii-raidz/ RAIDZ Levels]<br />
# [https://pthree.org/2012/12/06/zfs-administration-part-iii-the-zfs-intent-log/ The ZFS Intent Log]<br />
# [https://pthree.org/2012/12/07/zfs-administration-part-iv-the-adjustable-replacement-cache/ The ARC]<br />
# [https://pthree.org/2012/12/10/zfs-administration-part-v-exporting-and-importing-zpools/ Import/export zpools]<br />
# [https://pthree.org/2012/12/11/zfs-administration-part-vi-scrub-and-resilver/ Scrub and Resilver]<br />
# [https://pthree.org/2012/12/12/zfs-administration-part-vii-zpool-properties/ Zpool Properties]<br />
# [https://pthree.org/2012/12/13/zfs-administration-part-viii-zpool-best-practices-and-caveats/ Zpool Best Practices]<br />
# [https://pthree.org/2012/12/14/zfs-administration-part-ix-copy-on-write/ Copy on Write]<br />
# [https://pthree.org/2012/12/17/zfs-administration-part-x-creating-filesystems/ Creating Filesystems]<br />
# [https://pthree.org/2012/12/18/zfs-administration-part-xi-compression-and-deduplication/ Compression and Deduplication]<br />
# [https://pthree.org/2012/12/19/zfs-administration-part-xii-snapshots-and-clones/ Snapshots and Clones]<br />
# [https://pthree.org/2012/12/20/zfs-administration-part-xiii-sending-and-receiving-filesystems/ Send/receive Filesystems]<br />
# [https://pthree.org/2012/12/21/zfs-administration-part-xiv-zvols/ ZVOLs]<br />
# [https://pthree.org/2012/12/31/zfs-administration-part-xv-iscsi-nfs-and-samba/ iSCSI, NFS, and Samba]<br />
# [https://pthree.org/2013/01/02/zfs-administration-part-xvi-getting-and-setting-properties/ Get/Set Properties]<br />
# [https://pthree.org/2013/01/03/zfs-administration-part-xvii-best-practices-and-caveats/ ZFS Best Practices]</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Plex&diff=266817
Plex
2013-07-17T16:33:28Z
<p>Teratomata: </p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Networking]]<br />
{{Merge|List of Applications|This article doesn't offer more information than an entry in [[List of Applications]], although I think we'd need to create a new section for this kind of applications.}}<br />
Landing page for http://plexapp.com/<br />
<br />
Please contribute and update. Plex media server is installable via [[AUR]]: {{AUR|plexmediaserver}}.<br />
<br />
To start plex, run sudo systemctl start plexmediaserver. Use sudo systemctl enable plexmediaserver to have it start on startup. Then go to localhost:32400/manage to set up plex. If you want to add media folders in your home directory you may get a permissions issue. chmod 775 ~/ and usermod -a -G users plex to allow plex to access your files.</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Plex&diff=266810
Plex
2013-07-17T15:21:41Z
<p>Teratomata: </p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Networking]]<br />
{{Merge|List of Applications|This article doesn't offer more information than an entry in [[List of Applications]], although I think we'd need to create a new section for this kind of applications.}}<br />
Landing page for http://plexapp.com/<br />
<br />
Please contribute and update. Plex media server is installable via [[AUR]]: {{AUR|plexmediaserver}}.<br />
<br />
To start plex, run sudo systemctl start plexmediaserver. Use sudo systemctl enable plexmediaserver to have it start on startup. Then go to localhost:32400/manage to set up plex.</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Accents_on_US_keyboards&diff=258161
Accents on US keyboards
2013-05-21T22:53:07Z
<p>Teratomata: /* Key combinations */</p>
<hr />
<div>[[Category:Keyboards]]<br />
[[Category:Internationalization]]<br />
[[es:Accents on US keyboards]]<br />
Typing in foreign languages such as French, Italian and German can be difficult on an American keyboard. To remedy this, [[Xorg]] provides options such as the compose key and the [[xmodmap]] utility.<br />
<br />
== XCompose ==<br />
<br />
The compose key, when pressed in sequence with other keys, produces a Unicode character. E.g., in most configurations pressing {{ic|<Compose> ' e}} produces {{ic|é}}.<br />
<br />
Compose keys appeared on some computer keyboards decades ago, especially those produced by Sun Microsystems. However, it can be enabled on any keyboard with {{Ic|setxkbmap}}. For example, compose can be set to right alt by running:<br />
<br />
setxkbmap -option compose:ralt<br />
<br />
If you want another key to be your Compose key, see {{Ic|/usr/share/X11/xkb/rules/base.lst}} at the {{Ic|compose:}} lines.<br />
<br />
You may also edit your {{Ic|/etc/X11/xorg.conf.d/10-evdev.conf}} and change InputClass / 'evdev keyboard catchall' to look like this.<br />
<br />
Section "InputClass"<br />
Identifier "evdev keyboard catchall"<br />
MatchIsKeyboard "on"<br />
MatchDevicePath "/dev/input/event*"<br />
Driver "evdev"<br />
Option "XkbOptions" "terminate:ctrl_alt_bksp,compose:ralt"<br />
EndSection<br />
<br />
=== Key combinations ===<br />
<br />
By default, the compose key uses combinations defined in a file. The file used depends on the user's locale: an American using LC_CTYPE=en_US.UTF-8, for instance, would find the defaults in {{Ic|/usr/share/X11/locale/en_US.UTF-8/Compose}}.<br />
<br />
Some of the default combinations are listed below:<br />
<br />
Compose ` a : à<br />
Compose ' e : é<br />
Compose ^ i : î<br />
Compose ~ n : ñ<br />
Compose / o : ø<br />
Compose " u : ü<br />
Compose o c : ©<br />
Compose + - : ±<br />
Compose : - : ÷<br />
<br />
However, you can define your own compose key combinations by copying the default file to {{Ic|~/.XCompose}} and editing it. The compose key works with any of the thousands of valid Unicode characters, including those outside the Basic Multilingual Plane. However, GTK does not use xim by default and therefore does not follow {{Ic|~/.XCompose}} keys. This can be fixed by forcing GTK to use xim by adding {{Ic|export GTK_IM_MODULE&#61;xim}} to {{Ic|~/.xprofile}}, or forcing individual apps to use xim by running them as {{Ic|GKT_IM_MODULE&#61;xim ''command''}}. However not all apps, such as Sublime-Text 2 know how to use xim, and so uim-scim can be used instead of xim once the scim-uim package is installed. Note that this was tested on KDE.<br />
<br />
=== Environment variables ===<br />
<br />
Some unfriendly applications (including many GTK apps) will override the compose key and default to their own built-in combinations. You can typically fix this by setting environment variables; for instance, you can fix the behavior for GTK with:<br />
<br />
export GTK_IM_MODULE=xim<br />
<br />
== xmodmap ==<br />
<br />
The {{Ic|xmodmap}} utility that is supplied with [[Xorg]] allows user to completely remap the keyboard. See [[xmodmap#Accents on US keyboards]] for more information.</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Accents_on_US_keyboards&diff=258155
Accents on US keyboards
2013-05-21T22:31:29Z
<p>Teratomata: /* Key combinations */ Added notes about xim compatibility.</p>
<hr />
<div>[[Category:Keyboards]]<br />
[[Category:Internationalization]]<br />
[[es:Accents on US keyboards]]<br />
Typing in foreign languages such as French, Italian and German can be difficult on an American keyboard. To remedy this, [[Xorg]] provides options such as the compose key and the [[xmodmap]] utility.<br />
<br />
== XCompose ==<br />
<br />
The compose key, when pressed in sequence with other keys, produces a Unicode character. E.g., in most configurations pressing {{ic|<Compose> ' e}} produces {{ic|é}}.<br />
<br />
Compose keys appeared on some computer keyboards decades ago, especially those produced by Sun Microsystems. However, it can be enabled on any keyboard with {{Ic|setxkbmap}}. For example, compose can be set to right alt by running:<br />
<br />
setxkbmap -option compose:ralt<br />
<br />
If you want another key to be your Compose key, see {{Ic|/usr/share/X11/xkb/rules/base.lst}} at the {{Ic|compose:}} lines.<br />
<br />
You may also edit your {{Ic|/etc/X11/xorg.conf.d/10-evdev.conf}} and change InputClass / 'evdev keyboard catchall' to look like this.<br />
<br />
Section "InputClass"<br />
Identifier "evdev keyboard catchall"<br />
MatchIsKeyboard "on"<br />
MatchDevicePath "/dev/input/event*"<br />
Driver "evdev"<br />
Option "XkbOptions" "terminate:ctrl_alt_bksp,compose:ralt"<br />
EndSection<br />
<br />
=== Key combinations ===<br />
<br />
By default, the compose key uses combinations defined in a file. The file used depends on the user's locale: an American using LC_CTYPE=en_US.UTF-8, for instance, would find the defaults in {{Ic|/usr/share/X11/locale/en_US.UTF-8/Compose}}.<br />
<br />
Some of the default combinations are listed below:<br />
<br />
Compose ` a : à<br />
Compose ' e : é<br />
Compose ^ i : î<br />
Compose ~ n : ñ<br />
Compose / o : ø<br />
Compose " u : ü<br />
Compose o c : ©<br />
Compose + - : ±<br />
Compose : - : ÷<br />
<br />
However, you can define your own compose key combinations by copying the default file to {{Ic|~/.XCompose}} and editing it. The compose key works with any of the thousands of valid Unicode characters, including those outside the Basic Multilingual Plane. However, GTK does not use xim by default and therefore does not follow {{Ic|~/.XCompose}} keys. This can be fixed by forcing GTK to use xim by adding {{Ic|export GTK_IM_MODULE&#61;xim}} to {{Ic|~/.xprofile}}, or forcing individual apps to use xim by running them as {{Ic|GKT_IM_MODULE&#61;xim ''command''}}. However not all apps, such as Sublime-Text 2 know how to use xim, and so uim-scim can be used instead of xim once the scim-uim package is installed.<br />
<br />
=== Environment variables ===<br />
<br />
Some unfriendly applications (including many GTK apps) will override the compose key and default to their own built-in combinations. You can typically fix this by setting environment variables; for instance, you can fix the behavior for GTK with:<br />
<br />
export GTK_IM_MODULE=xim<br />
<br />
== xmodmap ==<br />
<br />
The {{Ic|xmodmap}} utility that is supplied with [[Xorg]] allows user to completely remap the keyboard. See [[xmodmap#Accents on US keyboards]] for more information.</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Users_and_groups&diff=257341
Users and groups
2013-05-16T19:35:14Z
<p>Teratomata: /* User management */ Fixed pronoun</p>
<hr />
<div>[[Category:Security]]<br />
[[es:Users and Groups]]<br />
[[fr:Utilisateurs et Groupes]]<br />
[[it:Users and Groups]]<br />
[[ja:Users and Groups]]<br />
[[ru:Users and Groups]]<br />
[[zh-CN:Users and Groups]]<br />
{{Article summary start}}<br />
{{Article summary text|This article describes how to manage user and group accounts. Whilst certain [[desktop environment]]s provide graphical user/group management tools, they are not discussed here.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Access control overview}}}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|DeveloperWiki:UID / GID Database}}<br />
{{Article summary wiki|PolicyKit}}<br />
{{Article summary wiki|chmod}}<br />
{{Article summary wiki|Change username}}<br />
{{Article summary end}}<br />
<br />
Users and groups are used on GNU/Linux for [[Wikipedia:access control#Computer security|access control]] — that is, to control access to the system's files, directories, and peripherals. Linux offers relatively simple/coarse access control mechanisms by default. For more advanced options, see [[ACL]] and [[LDAP Authentication]].<br />
<br />
== Overview ==<br />
A ''user'' is anyone who uses a computer. In this case, we are describing the names which represent those users. It may be Mary or Bill, and they may use the names Dragonlady or Pirate in place of their real name. All that matters is that the computer has a name for each account it creates, and it is this name by which a person gains access to use the computer. Some system services also run using restricted or privileged user accounts.<br />
<br />
Managing users is done for the purpose of security by limiting access in certain specific ways.<br />
<br />
Any individual may have more than one account, as long as they use a different name for each account they create. Further, there are some reserved names which may not be used such as "root".<br />
<br />
Users may be grouped together into a "group," and users may choose to join an existing group to utilize the privileged access it grants.<br />
<br />
{{Note|The beginner should use these tools carefully and stay away from having anything to do with any other ''existing'' user account, other than their own.}}<br />
<br />
== Permissions and ownership ==<br />
From [http://ph7spot.com/musings/in-unix-everything-is-a-file In UNIX Everything is a File]:<br />
<br />
:''The UNIX operating system crystallizes a couple of unifying ideas and concepts that shaped its design, user interface, culture and evolution. One of the most important of these is probably the mantra: "everything is a file," widely regarded as one of the defining points of UNIX.''<br />
<br />
:''This key design principle consists of providing a unified paradigm for accessing a wide range of input/output resources: documents, directories, hard-drives, CD-ROMs, modems, keyboards, printers, monitors, terminals and even some inter-process and network communications. The trick is to provide a common abstraction for all of these resources, each of which the UNIX fathers called a "file." Since every "file" is exposed through the same API, you can use the same set of basic commands to read/write to a disk, keyboard, document or network device.''<br />
<br />
From [http://www.intel-research.net/Publications/Pittsburgh/101220041324_277.pdf Extending UNIX File Abstraction for General-Purpose Networking]:<br />
<br />
:''A fundamental and very powerful, consistent abstraction provided in UNIX and compatible operating systems is the file abstraction. Many OS services and device interfaces are implemented to provide a file or file system metaphor to applications. This enables new uses for, and greatly increases the power of, existing applications — simple tools designed with specific uses in mind can, with UNIX file abstractions, be used in novel ways. A simple tool, such as cat, designed to read one or more files and output the contents to standard output, can be used to read from I/O devices through special device files, typically found under the {{ic|/dev}} directory. On many systems, audio recording and playback can be done simply with the commands, "{{ic|cat /dev/audio > myfile}}" and "{{ic|cat myfile > /dev/audio}}," respectively.''<br />
<br />
Every file on a GNU/Linux system is owned by a user and a group. In addition, there are three types of access permissions: read, write, and execute. Different access permissions can be applied to a file's owning user, owning group, and others (those without ownership). One can determine a file's owners and permissions by viewing the long listing format of the {{ic|ls}} command:<br />
<br />
{{hc|$ ls /boot/ -l|total 13740<br />
drwxr-xr-x 2 root root 4096 Jan 12 00:33 grub<br />
-rw-r--r-- 1 root root 8570335 Jan 12 00:33 kernel26-fallback.img<br />
-rw-r--r-- 1 root root 1821573 Jan 12 00:31 kernel26.img<br />
-rw-r--r-- 1 root root 1457315 Jan 8 08:19 System.map26<br />
-rw-r--r-- 1 root root 2209920 Jan 8 08:19 vmlinuz26}}<br />
<br />
The first column displays the file's permissions (for example, the file {{ic|kernel26.img}} has permissions {{ic|-rw-r--r--}}). The third and fourth columns display the file's owning user and group, respectively. In this example, all files are owned by the ''root'' user and the ''root'' group.<br />
<br />
{{hc|$ ls /media/ -l|total 16<br />
drwxrwx--- 1 root vboxsf 16384 Jan 29 11:02 sf_Shared}}<br />
<br />
In this example, the {{ic|sf_Shared}} directory is owned by the ''root'' user and the ''vboxsf'' group. It is also possible to determine a file's owners and permissions using the stat command:<br />
<br />
Owning user:<br />
<br />
{{hc|$ stat -c %U /media/sf_Shared/|root}}<br />
<br />
Owning group:<br />
<br />
{{hc|$ stat -c %G /media/sf_Shared/|vboxsf}}<br />
<br />
Access rights:<br />
<br />
{{hc|$ stat -c %A /media/sf_Shared/|drwxrwx---}}<br />
<br />
Access permissions are displayed in three groups of characters, representing the permissions of the owning user, owning group, and others, respectively. For example, the characters {{ic|-rw-r--r--}} indicate that the file's owner has read and write permission, but not execute ({{ic|rw-}}), whilst users belonging to the owning group and other users have only read permission ({{ic|r--}} and {{ic|r--}}). Meanwhile, the characters {{ic|drwxrwx---}} indicate that the file's owner and users belonging to the owning group all have read, write, and execute permissions ({{ic|rwx}} and {{ic|rwx}}), whilst other users are denied access ({{ic|---}}). The first character represents the file's type.<br />
<br />
List files owned by a user or group with the {{ic|find}} command:<br />
<br />
# find / -group [group]<br />
<br />
# find / -user [user]<br />
<br />
A file's owning user and group can be changed with the {{ic|chown}} (change owner) command. A file's access permissions can be changed with the {{ic|chmod}} (change mode) command.<br />
<br />
See [http://linux.die.net/man/1/chown man chown], [http://linux.die.net/man/1/chmod man chmod], and [http://www.tuxfiles.org/linuxhelp/filepermissions.html Linux file permissions] for additional detail.<br />
<br />
==File list==<br />
{{Warning|Do not edit these files by hand. There are utilities that properly handle locking and avoid invalidating the format of the database. See [[#User management]] and [[#Group management]] for an overview.}}<br />
<br />
{| border="1" <br />
! File || Purpose<br />
|-<br />
| {{ic|/etc/shadow}} || Secure user account information<br />
|-<br />
| {{ic|/etc/passwd}} || User account information<br />
|-<br />
| {{ic|/etc/gshadow}} || Contains the shadowed information for group accounts<br />
|-<br />
| {{ic|/etc/group}} || Defines the groups to which users belong<br />
|-<br />
| {{ic|/etc/sudoers}} || List of who can run what by sudo<br />
|-<br />
| {{ic|/home/*}} || Home directories<br />
|}<br />
<br />
== User management ==<br />
<br />
To list users currently logged on the system, the {{ic|who}} command can be used.<br />
<br />
To add a new user, use the {{ic|useradd}} command:<br />
<br />
# useradd -m -g [initial_group] -G [additional_groups] -s [login_shell] [username]<br />
<br />
* '''{{ic|-m}}''' creates the user home directory as {{ic|/home/[username]}}; within their home directory, a non-root user can write files, delete them, install programs, and so on.<br />
* '''{{ic|-g}}''' defines the group name or number of the user's initial login group; the group name must exist; if a group number is provided, it must refer to an already existing group; if not specified, the behavior of useradd will depend on the USERGROUPS_ENAB variable contained in {{ic|/etc/login.defs}}.<br />
* '''{{ic|-G}}''' introduces a list of supplementary groups which the user is also a member of; each group is separated from the next by a comma, with no intervening spaces; the default is for the user to belong only to the initial group.<br />
* '''{{ic|-s}}''' defines the path and filename of the user's default login shell; Arch Linux init scripts use Bash; after the boot process is complete, the default login shell is the one specified here; ensure the chosen shell package is installed if choosing something other than Bash.<br />
<br />
A typical desktop system example, adding a user named ''archie'' specifying bash as the login shell:<br />
# useradd -m -g users -s /bin/bash archie<br />
<br />
To enter user information for the ''GECOS'' field (e.g. the full user name), type:<br />
<br />
# chfn [username]<br />
<br />
(this way {{ic|chfn}} runs in interactive mode).<br />
<br />
To specify the user's password, type:<br />
<br />
# passwd [username]<br />
<br />
User accounts may be deleted with the {{ic|userdel}} command.<br />
<br />
# userdel -r [username]<br />
<br />
The {{ic|-r}} option specifies that the user's home directory and mail spool should also be deleted.<br />
<br />
=== User database ===<br />
<br />
Local user information is stored in the {{ic|/etc/passwd}} file. To list all user accounts on the system:<br />
<br />
$ cat /etc/passwd<br />
<br />
There is one line per account, and each is of the format:<br />
<br />
account:password:UID:GID:GECOS:directory:shell<br />
<br />
where:<br />
*{{ic|account}} is the user name<br />
*{{ic|password}} is the user password<br />
*{{ic|UID}} is the numerical user ID<br />
*{{ic|GID}} is the numerical primary group ID for the user<br />
*{{ic|GECOS}} is an optional field used for informational purposes; usually it contains the full user name<br />
*{{ic|directory}} is the user's {{ic|$HOME}} directory<br />
*{{ic|shell}} is the user command interpreter (defaults to {{ic|/bin/sh}})<br />
<br />
{{Note|1=Arch Linux uses ''shadowed'' passwords. The {{ic|passwd}} file is world-readable, so storing passwords (hashed or otherwise) in this file would be insecure. Instead, the {{ic|password}} field will contain a placeholder character ({{ic|x}}) indicating that the hashed password is saved in the access-restricted file {{ic|/etc/shadow}}.}}<br />
<br />
== Group management ==<br />
<br />
{{ic|/etc/group}} is the file that defines the groups on the system ({{ic|man group}} for details).<br />
<br />
Display group membership with the {{ic|groups}} command:<br />
<br />
$ groups [user]<br />
<br />
If {{ic|user}} is omitted, the current user's group names are displayed.<br />
<br />
The {{ic|id}} command provides additional detail, such as the user's UID and associated GIDs:<br />
<br />
$ id [user]<br />
<br />
To list all groups on the system:<br />
<br />
$ cat /etc/group<br />
<br />
Create new groups with the {{ic|groupadd}} command:<br />
<br />
# groupadd [group]<br />
<br />
Add users to a group with the {{ic|gpasswd}} command:<br />
<br />
# gpasswd -a [user] [group]<br />
<br />
To delete existing groups:<br />
<br />
# groupdel [group]<br />
<br />
To remove users from a group:<br />
<br />
# gpasswd -d [user] [group]<br />
<br />
If the user is currently logged in, he/she must log out and in again for the change to have effect.<br />
<br />
== Group list ==<br />
<br />
<br />
<br />
=== User groups ===<br />
<br />
{{Note|Some of these may not be needed when running a system with systemd. See [[Systemd#Supplementary_information|here]].}}<br />
{{Note|None of these groups is needed for standard desktop permissions like sound, 3D, printing, mounting, etc. as long as the ''logind'' session isn't broken (for example by starting X on a different VT than where you logged in).}}<br />
Workstation/desktop users often add their non-root user to some of following groups to allow access to peripherals and other hardware and facilitate system administration:<br />
<br />
{| border="1" <br />
! Group || Affected files || Purpose<br />
|-<br />
| audio || {{ic|/dev/audio}}, {{ic|/dev/snd/*}}, {{ic|/dev/rtc0}} || Direct access to sound hardware, for all sessions (requirement is imposed by both [[ALSA]] and [[OSS]]). Local sessions already have the ability to play sound and access mixer controls.<br />
|-<br />
| camera || || Access to [[Digital Cameras]].<br />
|-<br />
| disk || {{ic|/dev/sda[1-9]}}, {{ic|/dev/sdb[1-9]}} || Access to block devices not affected by other groups such as ''optical'', ''floppy'', and ''storage''.<br />
|-<br />
| floppy || {{ic|/dev/fd[0-9]}} || Access to floppy drives.<br />
|-<br />
| games || {{ic|/var/games}} || Access to some game software.<br />
|-<br />
| locate || {{ic|/usr/bin/locate}}, {{ic|/var/lib/locate}}, {{ic|/var/lib/mlocate}}, {{ic|/var/lib/slocate}} || Right to use [[Wikipedia:updatedb|updatedb]] command.<br />
|-<br />
| lp || {{ic|/etc/cups}}, {{ic|/var/log/cups}}, {{ic|/var/cache/cups}}, {{ic|/var/spool/cups}} || Access to printer hardware; enables the user to manage print jobs.<br />
|-<br />
| network || || Right to change network settings such as when using [[NetworkManager]]. <br />
|-<br />
| networkmanager || || Requirement for your user to connect wirelessly with [[NetworkManager]]. This group is not included with Arch by default so it must be added manually.<br />
|-<br />
| optical || {{ic|/dev/sr[0-9]}}, {{ic|/dev/sg[0-9]}} || Access to optical devices such as CD and DVD drives.<br />
|-<br />
| power || || Right to use [[Pm-utils]] (suspend, hibernate...) and power management controls.<br />
|-<br />
| scanner || {{ic|/var/lock/sane}} || Access to scanner hardware.<br />
|-<br />
| storage || || Access to removable drives such as USB hard drives, flash/jump drives, MP3 players; enables the user to mount storage devices.<br />
|-<br />
| sys || || Right to admin printers in [[CUPS]].<br />
|-<br />
| users || || Standard users group.<br />
|-<br />
| uucp || {{ic|/dev/ttyS[0-9]}}, {{ic|/dev/tts/[0-9]}} || Serial and USB devices such as modems, handhelds, RS-232/serial ports.<br />
|-<br />
| video || {{ic|/dev/fb/0}}, {{ic|/dev/misc/agpgart}} || Access to video capture devices, 2D/3D hardware acceleration, framebuffer ([[Xorg|X]] can be used ''without'' belonging to this group). Local sessions already have the ability to use hardware acceleration and video capture.<br />
|-<br />
| wheel || || Administration group, commonly used to give access to the sudo and su commands (neither uses it by default). Will be used in the future by systemd to allow starting/stopping services as non-root.[http://cgit.freedesktop.org/systemd/systemd/tree/TODO#n79]<br />
|}<br />
<br />
=== System groups ===<br />
The following groups are used for system purposes and are not likely to be used by novice Arch users:<br />
<br />
{| border="1" <br />
! Group || Affected files || Purpose<br />
|-<br />
| avahi || ||<br />
|-<br />
| bin || {{ic|/usr/bin/*}} || Read-only access to the binary files in {{Ic|/usr/bin/}}<br />
|-<br />
| clamav || {{ic|/var/lib/clamav/*}}, {{ic|/var/log/clamav/*}} || Used by [[Clam AntiVirus]].<br />
|-<br />
| daemon || ||<br />
|-<br />
| dbus || {{ic|/var/run/dbus/*}} ||<br />
|-<br />
| ftp || {{ic|/srv/ftp}} || used by [[Wikipedia:FTP|FTP]] servers like [[Proftpd]]<br />
|-<br />
| gdm || X server authorization directory (ServAuthDir) || [[GDM]] group.<br />
|-<br />
| hal || {{ic|/var/run/hald}}, {{ic|/var/cache/hald}} ||<br />
|-<br />
| http || ||<br />
|-<br />
| kmem || {{ic|/dev/port}}, {{ic|/dev/mem}}, {{ic|/dev/kmem}} ||<br />
|-<br />
| log || {{ic|/var/log/*}} || Access to log files in {{ic|/var/log}}.<br />
|-<br />
| mail || {{ic|/usr/bin/mail}} ||<br />
|-<br />
| mem || ||<br />
|-<br />
| mpd || {{Ic|/var/lib/mpd/*}}, {{Ic|/var/log/mpd/*}}, {{Ic|/var/run/mpd/*}}, optionally music directories || [[MPD]] group.<br />
|-<br />
| nobody || || Unprivileged group.<br />
|-<br />
| ntp || {{Ic|/var/lib/ntp/*}} || [[NTPd]] group.<br />
|-<br />
| policykit || || [[PolicyKit]] group.<br />
|-<br />
| root || {{ic|/*}} || Complete system administration and control (root, admin).<br />
|-<br />
| smmsp || || [[Wikipedia:sendmail|sendmail]] group.<br />
|-<br />
| systemd-journal || {{ic|/var/log/journal/*}} || Provides access to the complete systemd logs. Otherwise, only user generated messages are displayed.<br />
|-<br />
| tty || {{ic|/dev/tty}}, {{ic|/dev/vcc}}, {{ic|/dev/vc}}, {{ic|/dev/ptmx}} || Eg. to acces {{Ic|/dev/ACMx}}<br />
|-<br />
| vboxsf || virtual machines' shared folders || Used by [[VirtualBox]].<br />
|-<br />
| fuse || || Used by fuse to allow user mounts.<br />
|}<br />
<br />
=== Software groups ===<br />
These groups allow its members to use specific software:<br />
<br />
{| border="1" <br />
! Group || Affected files || Purpose<br />
|-<br />
| adbusers || devices nodes under {{ic|/dev/}} || Right to access [[Android]] Debugging Bridge.<br />
|-<br />
| cdemu || {{ic|/dev/vhba_ctl}} || Right to use [[cdemu]] drive emulation.<br />
|-<br />
| kvm || {{ic|/dev/kvm}} || Benefit from [[KVM]]'s-Hardware-assisted virtualization speed if your Processor features either [http://www.linux-kvm.org/page/FAQ#What_do_I_need_to_use_KVM.3F Intel's VT-x or AMD's AMD-V] extension.<br />
|-<br />
| thinkpad || {{ic|/dev/misc/nvram}} || Used by ThinkPad users for access to tools such as [[tpb]].<br />
|-<br />
| vboxusers || {{ic|/dev/vboxdrv}} || Right to use VirtualBox software.<br />
|-<br />
| vmware || || Right to use [[VMware]] software.<br />
|-<br />
| ssh || || [[Sshd]] can be configured to only allow members of this group to login.<br />
|-<br />
| wireshark || || Right to capture packets with [[Wireshark]].<br />
|}<br />
<br />
=== Deprecated or unused groups ===<br />
Following groups are currently of no use for anyone:<br />
<br />
{| border="1" <br />
! Group || Purpose<br />
|-<br />
| rfkill || '''Unused!''' Right to control wireless devices power state (probably should be used by {{Pkg|rfkill}}).<br />
|-<br />
| stb-admin || '''Unused!''' Right to access [http://system-tools-backends.freedesktop.org/ system-tools-backends]<br />
|}</div>
Teratomata
https://wiki.archlinux.org/index.php?title=File_systems&diff=257069
File systems
2013-05-14T20:11:00Z
<p>Teratomata: /* In console */ Added swap instructions.</p>
<hr />
<div>[[Category:File systems]]<br />
[[es:File Systems]]<br />
[[It:File Systems]]<br />
[[ja:File Systems]]<br />
[[pl:File Systems]]<br />
[[zh-cn:File Systems]]<br />
{{Article summary start}}<br />
{{Article summary text|An overview of the types of file systems available.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Partitioning}}<br />
{{Article summary end}}<br />
<br />
From [[Wikipedia:File system|Wikipedia]]:<br />
:''A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device.''<br />
<br />
Individual drive partitions can be setup using one of the many different available filesystems. Each has its own advantages, disadvantages, and unique idiosyncrasies. A brief overview of supported filesystems follows; the links are to wikipedia pages that provide much more information.<br />
<br />
Before being formatted, a drive should be [[Partitioning|partitioned]].<br />
<br />
==Type of File Systems==<br />
<br />
* [[Wikipedia:ext2|ext2]] '''Second Extended Filesystem''' is an established, mature GNU/Linux filesystem that is very stable. A drawback is that it does not have journaling support (see below) or barriers. Lack of journaling can result in data loss in the event of a power failure or system crash. It may also be inconvenient for root ({{ic|/}}) and {{ic|/home}} partitions because file-system checks can take a long time. An ext2 filesystem can be converted to ext3.<br />
* [[ext3]] '''Third Extended Filesystem''' is essentially the ext2 system with journaling support and write barriers. It is backward compatible with ext2, well tested, and extremely stable.<br />
* [[ext4]] '''Fourth Extended Filesystem''' is a newer filesystem that is also compatible with ext2 and ext3. It provides support for volumes with sizes up to 1 exabyte (i.e. 1,048,576 terabytes) and files sizes up to 16 terabytes. It increases the 32,000 subdirectory limit in ext3 to 64,000. It also offers online defragmentation capability.<br />
* [[Wikipedia:ReiserFS|ReiserFS]] (V3) Hans Reiser's high-performance journaling FS uses a very interesting method of data throughput based on an unconventional and creative algorithm. ReiserFS is touted as very fast, especially when dealing with many small files. ReiserFS is fast at formatting, yet comparatively slow at mounting. Quite mature and stable. ReiserFS (V3) is not being actively developed at this time. Generally regarded as a good choice for {{ic|/var}}.<br />
* [[Wikipedia:JFS (file system)|JFS]] IBM's '''Journaled File System''' was the first filesystem to offer journaling. It had many years of development in the IBM AIX® operating system before being ported to GNU/Linux. JFS makes the smallest demand on CPU resources of any GNU/Linux filesystem. It is very fast at formatting, mounting, and filesystem checks (fsck). JFS offers very good all-around performance especially in conjunction with the deadline I/O scheduler. It is not as widely supported as the ext series or ReiserFS, but still very mature and stable.{{Note|The JFS filesystem cannot be shrunk by disk utilities such as '''gparted'''.}}<br />
* [[Wikipedia:XFS|XFS]] is another early journaling filesystem originally developed by Silicon Graphics for the IRIX operating system and ported to GNU/Linux. It provides very fast throughput on large files and filesystems and is very fast at formatting and mounting. Comparative benchmark testing has shown it to be slower when dealing with many small files. XFS is very mature and offers online defragmentation capability.{{Note|The XFS filesystem cannot be shrunk by disk utilities such as '''gparted'''.}}<br />
* [[Wikipedia:File Allocation Table#VFAT|VFAT]] or '''Virtual File Allocation Table''' is technically simple and supported by virtually all existing operating systems. This makes it a useful format for solid-state memory cards and a convenient way to share data between operating systems. VFAT supports long file names.<br />
* [[Btrfs]] Also known as "Better FS", '''Btrfs''' is a new filesystem with powerful features similar to Sun/Oracle's excellent [[Wikipedia:ZFS|ZFS]]. These include snapshots, multi-disk striping and mirroring (software RAID without mdadm), checksums, incremental backup, and on-the-fly compression that can give a significant performance boost as well as save space. As of January 2011, Btrfs is considered unstable although it has been merged into the mainline kernel with an experimental status. Btrfs appears to be the future of GNU/Linux filesystems and is offered as a root filesystem option in all major distribution installers.<br />
* [[Wikipedia:NILFS|NILFS2]] '''New Implementation of a Log-structured File System''' was developed by NTT. It records all data in a continuous log-like format that is only appended to and never overwritten. It is designed to reduce seek times and minimize the type of data loss that occurs after a crash with conventional Linux filesystems.<br />
* [[Swap]] is the filesystem used for swap partitions.<br />
* [[Wikipedia:NTFS|NTFS]] - File system used by windows. Mountable with many utilities (e.g. [[NTFS-3G]]).<br />
<br />
===Journaling===<br />
<br />
All the above filesystems with the exception of ext2 use [http://en.wikipedia.org/wiki/Journaling_file_system journaling]. Journaling provides fault-resilience by logging changes before they are committed to the filesystem. In the event of a system crash or power failure, such file systems are faster to bring back online and less likely to become corrupted. The logging takes place in a dedicated area of the filesystem.<br />
<br />
Not all journaling techniques are the same. Only ext3 and ext4 offer data-mode journaling, which logs both data and meta-data. Data-mode journaling comes with a speed penalty and is not enabled by default. The other filesystems provide ordered-mode journaling, which only logs meta-data. While all journaling will return a filesystem to a valid state after a crash, data-mode journaling offers the greatest protection against corruption and data loss. There is a compromise in system performance, however, because data-mode journaling does two write operations: first to the journal and then to the disk. The trade-off between system speed and data safety should be considered when choosing the filesystem type.<br />
<br />
== Format a device ==<br />
{{Warning|formatting a device removes everything on it, make sure to backup everything you want to keep.}}<br />
<br />
===Pre-requirements===<br />
Before starting, you need to know which name Linux gave to your device. Hard drives and USB sticks show up as {{ic|/dev/sd''x''}}, where "x" is a lowercase letter, while partitions show up as {{ic|/dev/sd''xY''}}, where "Y" is a number.<br />
<br />
If the device you want to format is mounted, it will show up in the ''MOUNTPOINT'' column from:<br />
<br />
$ lsblk<br />
<br />
If your device is not mounted:<br />
<br />
# mount /dev/sd''xY'' /some/directory<br />
<br />
And to unmount it, you can use ''umount'' on the directory you mounted the disk on:<br />
<br />
# umount /some/directory<br />
<br />
{{note|Your device must be unmounted to format and create a new file system.}}<br />
<br />
===Step 1: delete old partitions, create new ones===<br />
<br />
For that you can use {{ic|fdisk}} (for MBR) or {{ic|gdisk}} (for GPT). See [[partitioning]] for more information.<br />
<br />
===Step 2: create the new file system===<br />
==== In console====<br />
To create a file system you just have to use {{ic|mkfs}}:<br />
<br />
# mkfs -t ext4 /dev/''<partition>''<br />
<br />
As {{ic|mkfs}} is just a unified front-end for the different {{ic|mkfs.''fstype''}} tools, you need to install the packages providing these tools for each filesystem you want to use:<br />
<br />
* {{pkg|btrfs-progs}} provides {{ic|btrfs}}<br />
* {{pkg|e2fsprogs}} provides {{ic|ext2}}, {{ic|ext3}} and {{ic|ext4}}<br />
* {{pkg|jfsutils}} provides {{ic|jfs}}<br />
* {{pkg|ntfs-3g}} provides {{ic|ntfs}}<br />
* {{pkg|reiserfsprogs}} provides {{ic|reiserfs}}<br />
* {{pkg|dosfstools}} provides {{ic|vfat}} (also known as {{ic|msdos}})<br />
* {{pkg|xfsprogs}} provides {{ic|xfs}}<br />
* {{pkg|nilfs-utils}} provides {{ic|nilfs2}}<br />
<br />
To create a swap file system, use {{ic|mkswap}}:<br />
<br />
# mkswap /dev/''<partition>''<br />
<br />
=== GUI tools ===<br />
There are several GUI tools for partition management:<br />
*[http://gparted.sourceforge.net/ GParted] (GTK) is available in extra<br />
* {{pkg|gnome-disk-utility}}<br />
*[http://www.kde-apps.org/content/show.php/KDE+Partition+Manager?content=89595 KDE Partition Manager] (KDE/Qt) is available in [[AUR]]</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Steam&diff=241007
Steam
2012-12-20T16:37:15Z
<p>Teratomata: Added fix for KDE/Oxygen icons.</p>
<hr />
<div>[[Category:Gaming]]<br />
[[Category:Wine]]<br />
[[ja:Steam]]<br />
[[zh-CN:Steam]]<br />
{{Article summary start}}<br />
{{Article summary text|[http://store.steampowered.com/about/ Steam] is a content delivery system made by Valve Software. It is best known as the platform needed to play Source Engine games (e.g. Half-Life 2, Counter-Strike). Today it offers many games from many other developers.}}<br />
<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Wine}}<br />
{{Article summary end}}<br />
<br />
See the [[Wikipedia:Steam_(software)|project Wiki page]] and the page in the [http://appdb.winehq.org/objectManager.php?sClass=version&iId=19444 Application Database] for more info.<br />
<br />
== Native Steam on Linux ==<br />
<br />
{{Note|Arch Linux is not [https://support.steampowered.com/kb_article.php?ref&#61;1504-QHXN-8366 officially supported].}}<br />
<br />
{{Note|Some games may need additional dependencies.}}<br />
<br />
{{Note|Because the Steam client is a 32-bit application, you need to enable [[Multilib]] in pacman '''if you have a pure 64-bit installation'''. It may also make sense to install multilib-devel to provide some important multilib libraries. You also most likely need to install the 32-bit version of your graphics driver to run steam.}}<br />
<br />
Install {{aur|steam}} from the [[AUR]].<br />
(Current licensing prevents steam from being put in the community/multilib repository, see the [https://mailman.archlinux.org/pipermail/arch-dev-public/2012-November/024046.html mailing list thread])<br />
<br />
Steam makes heavy usage of the Arial font. To make fonts look better, you may wish to install the {{aur|ttf-microsoft-arial}} or {{aur|ttf-ms-fonts}} package from the [[AUR]].<br />
<br />
Even without being in the private beta, it can be started by opening a steam URL {{ic|steam://open/games}}. You can enter this url into web browser, or terminal emulator.<br />
<br />
===Fixes/Bugs/Error Messages===<br />
<br />
Steam is ''beta software'' which is '''not supported''' on this distribution. As such some fixes are needed on the users part to get things functioning properly. Several games have dependencies which may be missing from your system. If a game fails to launch (often without error messages) then make sure all of the libraries listed below that game are installed. (Please help us expand on this list)<br />
<br />
====GUI problems with KDE====<br />
<br />
If you are using KDE and you have problems with the GUI (such as lag or random crashes) modify the compositing type to OpenGL/Raster. So don't use the XRender!<br />
<br />
====Mouse Cursor Overwritten ====<br />
Steam overwrites the [[Cursor Themes|X11 Cursor theme]] when it launches. This is a problem with Gnome and other WMs/DMs that do not set a cursor theme. You can overcome this for Gnome by setting a mouse cursor theme.<br />
<br />
To fix this issue, become root and put the following into {{ic|/usr/share/icons/default/index.theme}} (creating the directory {{ic|/usr/share/icons/default}} if necessary):<br />
{{hc|/usr/share/icons/default/index.theme|<nowiki><br />
[Icon Theme]<br />
Inherits=Adwaita<br />
</nowiki>}}<br />
<br />
Note: Instead of "Adwaita", you can choose another cursor theme (e.g. Human).<br />
Alternatively, you can install {{AUR|gnome-cursors-fix}} from the [[AUR]].<br />
<br />
Alternatively, you can create a symlink {{ic|~/.icons/default}} that points to the entry for your cursor in {{ic|/usr/share/icons}}, for example:<br />
<br />
mkdir -p ~/.icons<br />
ln -sT /usr/share/icons/Neutral_Plus ~/.icons/default<br />
<br />
If the cursor gets stuck pointing in the wrong direction after exiting Steam, a workaround is to run <code>xsetroot -cursor_name left_ptr</code> (From [http://awesome.naquadah.org/wiki/FAQ#How_to_change_the_cursor_theme.3F the awesomewm wiki]).<br />
<br />
If a cursor theme is set and Steam is still causing cursor problems then your cursor theme may not have the cursors under the names that Steam is looking at, for example KDE's cursor theme, Oxygen_White, the file for the cursor is 'left_ptr' but Steam is looking for 'arrow'. The simplest solution is to make symlinks to the appropriate cursor files.<br />
<br />
cd /usr/share/icons/Oxygen_White/cursors/<br />
ln -s ./left_ptr ./arrow<br />
ln -s ./size_fdiag ./bottom_right_corner<br />
ln -s ./size_fdiag ./top_left_corner<br />
ln -s ./size_bdiag ./bottom_left_corner<br />
ln -s ./size_bdiag ./top_right_corner<br />
ln -s ./size_hor ./left_side<br />
ln -s ./size_hor ./right_side<br />
ln -s ./size_ver ./top_side<br />
ln -s ./size_ver ./bottom_side<br />
<br />
The above should work for any KDE compatible cursor theme, but may not work for other ones if the cursor theme uses different names than size_fdiag, size_bdiag, size_hor, and size_ver.<br />
<br />
====Steam won't start on x64 with Intel HD Graphics====<br />
If you have '''/home/username/.local/share/Steam/steam.sh: line 287''' error and you running 64-bit linux with Intel HD Graphics just install {{pkg|lib32-intel-dri}}<br />
<br />
====Amnesia: The Dark Descent====<br />
=====Dependencies=====<br />
<br />
* {{pkg|lib32-freealut}}<br />
* {{pkg|lib32-glu}}<br />
* {{pkg|lib32-libxmu}}<br />
* {{pkg|lib32-sdl_ttf}}<br />
<br />
=====Troubleshooting=====<br />
======Segfault======<br />
If you are using open source drivers you will need {{aur|lib32-libtxc_dxtn}} . See [http://www.frictionalgames.com/forum/thread-10924.html oficial forum] for details<br />
<br />
======Running from steam displays empty window======<br />
${install_dir}/run_steam.sh uses `arch` to check if the system is 32 or 64 bit. Replace `arch` with `uname -m`.<br />
<br />
====And Yet It Moves====<br />
=====Dependencies=====<br />
* {{aur|lib32-libtheora}}<br />
* {{aur|lib32-libjpeg6}}<br />
* {{aur|lib32-libtiff4}}<br />
<br />
=====Compatibility=====<br />
Game refuses to launch and following message can be observed on console<br />
readlink: extra operand ‘Yet’<br />
Try 'readlink --help' for more information.<br />
To fix this, open {{ic|~/.steam/root/SteamApps/common/And Yet It Moves/AndYetItMovesSteam.sh}} in text editor and replace line<br />
ayim_dir="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"<br />
with<br />
<br />
ayim_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"<br />
<br />
====Harvest: Massive Encounter====<br />
=====Dependencies=====<br />
{{Note|Some dependencies seem to be not available yet}}<br />
* libstdc++6<br />
* libc6<br />
* libgcc1<br />
* libgtk2.0-0<br />
* libvorbisfiles3<br />
* {{pkg|nvidia-cg-toolkit}} or {{aur|lib32-nvidia-cg-toolkit}}<br />
* {{aur|libjpeg6}} or {{aur|lib32-libjpeg6}}<br />
<br />
====Killing Floor====<br />
=====Troubleshooting=====<br />
======screen resolution======<br />
Killing Floor runs pretty much from scratch, although you might have to change in-game resolution screen as the default one is '''800x600''' and a '''4:3''' screen format.<br />
If you try to modify screen resolution in-game, it might crash your desktop enviroment.<br />
To fix this, please set the desired resolution screen size by modifing your {{ic|~/.killingfloor/System/KillingFloor.ini}} with your prefered editor.<br />
{{hc|# nano ~/.killingfloor/System/KillingFloor.ini|<nowiki><br />
...<br />
<br />
[WinDrv.WindowsClient]<br />
WindowedViewportX=????<br />
WindowedViewportY=????<br />
FullscreenViewportX=????<br />
FullscreenViewportY=????<br />
MenuViewportX=???<br />
MenuViewportY=???<br />
<br />
...<br />
<br />
[SDLDrv.SDLClient]<br />
WindowedViewportX=????<br />
WindowedViewportY=????<br />
FullscreenViewportX=????<br />
FullscreenViewportY=????<br />
MenuViewportX=????<br />
MenuViewportY=????<br />
<br />
...<br />
</nowiki>}}<br />
{{Note|Replace all the '''????''' with the corresponding numbers according the desired resolution. If you have an 1366x768 screen and want to use it at it's fullest, change all the Viewport fields to something like '''ViewportX&#61;1366''' and '''ViewportY&#61;768''' in the corresponding areas.}}<br />
{{Note| The dots in the middle indicate that there are more fields in that .ini file. But for screen resolution troubleshooting, you don't need to modify anything else.}}<br />
<br />
Save the file and restart the game, it should work now.<br />
<br />
====== Windowed Mode ======<br />
<br />
Uncheck fullscreen in the options menu, and use Ctrl-G to stop mouse capturing (that was non obvious to discover..). This way you can easily minimize it and do other other things..and let your WM handle things.<br />
<br />
====Penumbra: Overture====<br />
=====Dependencies=====<br />
(Taken from {{aur|penumbra-collection}} and {{aur|penumbra-overture-ep1-demo}})<br />
* {{pkg|lib32-openal}}<br />
* {{pkg|lib32-sdl_ttf}}<br />
* {{pkg|lib32-libvorbis}}<br />
* {{pkg|lib32-libxft}}<br />
* {{pkg|lib32-glu}}<br />
* {{pkg|lib32-sdl_image}}<br />
<br />
=====Troubleshooting=====<br />
======Segfault after intro video======<br />
The game crashes with a segfault after the intro video due to incompatibility with the version of libvorbis in [extra] (or lib32-libvorbis in [multilib] if you're on x86_64). To fix this you have to use the libvorbis.so.0 shipped with the game:<br />
<br />
cd ~/.local/share/Steam/SteamApps/common/Penumbra\ Overture/lib<br />
cp all/libvorbis.so.0 libvorbis.so.0<br />
<br />
After this you should be able to play.<br />
<br />
======Windowed Mode======<br />
There is no in-game option to change to the windowed mode, you will have to edit {{ic|~/.frictionalgames/Penumbra/Overture/settings.cfg}} to activate it.<br />
Find {{ic|FullScreen&#61;"true"}} and change it to {{ic|FullScreen&#61;"false"}}, after this the game should start in windowed mode.<br />
<br />
====Serious Sam 3: BFE====<br />
=====Dependencies=====<br />
<br />
* {{aur|lib32-pciutils}} - Useless as now SS3 uses lspci in a recent beta release (From [http://steamcommunity.com/app/41070/discussions/0/828924672560153011/ SteamCommunity]).<br />
<br />
====Steel Storm: Burning Retribution====<br />
=====Troubleshooting=====<br />
======Start with black screen======<br />
The game tries to launch in 1024x768 resolution with fullscreen mode by default. It is impossible on some devices.<br />
(for example laptop Samsung Series9 with intel hd4000 video).<br />
But you can try to launch the game in windowed mode. <br />
<br />
Open game Properties in Steam, in General tab select "Set launch options..." and type "-window".<br />
<br />
Then you can change a resolution in game.<br />
<br />
======No English fonts======<br />
If you use intel video card, just disable S3TC in DriConf.<br />
<br />
====Superbrothers: Sword & Sworcery EP====<br />
<br />
=====Dependencies=====<br />
<br />
* {{aur|lib32-curl}}<br />
* {{Pkg|lib32-glu}}<br />
<br />
====Team Fortress 2 ====<br />
=====Dependencies=====<br />
<br />
* {{aur|lib32-libtxc_dxtn}}<br />
<br />
=====Troubleshooting=====<br />
======No audio======<br />
It happens if there is no PulseAudio in your system.<br />
If you want to use Alsa, you need to launch the Steam or game directly with {{ic|SDL_AUDIODRIVER&#61;alsa}} <br />
(From [http://steamcommunity.com/app/221410/discussions/0/882966056462819091/#c882966056470753683 SteamCommunity]).<br />
<br />
====The Book of Unwritten Tales====<br />
If the game does not start, go to Properties --> Uncheck "Enable Steam Community In-Game"<br />
=====Dependencies=====<br />
* {{aur|lib32-libxaw}}<br />
* {{aur|lib32-jasper}}<br />
<br />
====Trine 2====<br />
=====Dependencies=====<br />
<br />
* {{pkg|lib32-glu}}<br />
<br />
=====Troubleshooting=====<br />
<br />
* If colors are wrong with FOSS drivers (r600g at least), try to run the game in windowed mode, rendering will be corrected.<br />
<br />
== Steam on Wine ==<br />
<br />
Install {{Pkg|wine}} from the official repositories and follow the instructions provided in the [[Wine|article]].<br />
<br />
Install the required Microsoft fonts {{AUR|ttf-microsoft-tahoma}} and {{AUR|ttf-ms-fonts}} from the [[AUR]] or through {{AUR|winetricks-svn}}.<br />
{{Note|If you have access to Windows discs, you may want to install {{AUR|ttf-win7-fonts}} instead.}}<br />
<br />
If you have an old Wine prefix ({{ic|~/.wine}}), you should remove it and let Wine create a new one to avoid problems (you can transfer over anything you want to keep to the new Wine prefix).<br />
<br />
===Installation===<br />
<br />
Download and run the Steam installer from [http://store.steampowered.com/about/ steampowered.com]. It is no longer an {{ic|.exe}} file so you have to start it with {{ic|msiexec}}: <br />
$ msiexec /i SteamInstall.msi<br />
<br />
===Starting Steam===<br />
<br />
On x86:<br />
$ wine ~/.wine/drive_c/Program\ Files/Steam/Steam.exe<br />
<br />
On x86_64 (with steam installed to a clean wine prefix):<br />
$ wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe<br />
<br />
Alternatively, you may use this method:<br />
<br />
$ wine "C:\\Program Files\\Steam\\steam.exe" <br />
<br />
You should consider making an alias to easily start steam (and put it in your shell's rc file), example:<br />
alias steam='wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe >/dev/null 2>&1 &'<br />
<br />
{{Note|If you are using an nvidia card through bumblebee, you should prefix those commands with {{ic|optirun}}.}}<br />
<br />
===Tips===<br />
<br />
====Performance====<br />
<br />
Consider disabling wine debugging output by adding this to your shell rc file:<br />
export WINEDEBUG=-all<br />
or, just add it to your steam alias to only disable it for steam:<br />
alias steam='WINEDEBUG=-all wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe >/dev/null 2>&1 &'<br />
Additionally, Source games rely on a paged pool memory size specification for audio, and WINE by default does not have this set. To set it:<br />
wine reg add "HKLM\\System\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\" /v PagedPoolSize /t REG_DWORD /d 402653184 /f<br />
<br />
==== Application Launch Options ====<br />
Go to "Properties" -> "Set Launch Options", e.g.:<br />
{{bc|-console -dxlevel 90 -width 1280 -height 1024<br />
}}<br />
* {{ic|console}}<br />
Activate the console in the application to change detailed applications settings.<br />
* {{ic|dxlevel}}<br />
Set the application's DirectX level, e.g. 90 for DirectX Version 9.0. It is recommended to use the video card's DirectX version to prevent crashes. See the official Valve Software Wiki http://developer.valvesoftware.com/wiki/DirectX_Versions for details.<br />
* {{ic|width}} and {{ic|height}}<br />
Set the screen resolution. In some cases the graphic settings are not saved in the application and the applications always starts in the default resolution.<br />
Please refer to http://developer.valvesoftware.com/wiki/Launch_options for a complete list of launch options.<br />
<br />
==== Using a Pre-Existing Steam Install ====<br />
<br />
If you have a shared drive with Windows, or already have a Steam installation somewhere else, you can simply symlink the Steam directory to {{ic|~/.wine/drive_c/Program Files/Steam/}} . However, be sure to do '''all''' the previous steps in this wiki. Confirm Steam launches and logs into your account, ''then'' do this:<br />
<br />
cd ~/.wine/drive_c/Program\ Files/ <br />
mv Steam/ Steam.backup/ (or you can just delete the directory)<br />
ln -s /mnt/windows_partition/Program\ Files/Steam/<br />
<br />
{{Note|If you have trouble starting Steam after symlinking the entire Steam folder, try linking only the {{ic|steamapps}} subdirectory in your existing wine steam folder instead.}}<br />
<br />
====Running Steam in a second X Server====<br />
<br />
Assuming you are using the script above to start Steam, make a new script, called {{ic|x.steam.sh}}. You should run this when you want to start Steam in a new X server, and {{ic|steam.sh}} if you want Steam to start in the current X server. <br />
<br />
If due to misconfiguration a black screen is shown, you could always close down the second X server by pressing {{Keypress|Ctrl}} + {{Keypress|Alt}} + {{Keypress|Backspace}}.<br />
<br />
{{bc|1=<br />
#!/bin/bash <br />
<br />
DISPLAY=:1.0<br />
<br />
xinit $HOME/steam.sh $* -- :1<br />
}}<br />
<br />
Now you can use {{Keypress|Ctrl}} + {{Keypress|Alt}} + {{Keypress|F7}} to get to your first X server with your normal desktop, and {{Keypress|Ctrl}} + {{Keypress|Alt}} + {{Keypress|F8}} to go back to your game. <br />
<br />
Because the second X server is ''only'' running the game and the first X server with all your programs is backgrounded, performance should increase. In addition, it is much more convenient to switch X servers while in game to access other resources, rather than having to exit the game completely or {{Keypress|Alt}}-{{Keypress|Tab}} out. Finally, it is useful for when Steam or WINE goes haywire and leaves a bunch of processes in memory after Steam crashes. Simply {{Keypress|Ctrl}} + {{Keypress|Alt}} + {{Keypress|Backspace}} on the second X server to kill that X and all processes on that desktop will terminate as well. <br />
<br />
'''If you get errors that look like "Xlib: connection to ":1.0" refused by server" when starting the second X''': You will need to adjust your X permissions.<br />
<br />
'''If you lose the ability to use the keyboard while using Steam''': This is an odd bug that does not happen with other games. A solution is to use a WM in the second X as well. Thankfully, you do not need to run a large WM. Openbox and icewm have been confirmed to fix this bug (evilwm, pekwm, lwm ''do not'' work), but the icewm taskbar shows up on the bottom of the game, thus it's recommended to use [[Openbox]]. Install {{Pkg|openbox}} from the [[official repositories]], then add {{Ic|openbox &}} to the top of your {{ic|steam.sh}} file. Note you can run other programs (ex. Teamspeak &) or set X settings (ex. xset, xmodmap) before the WINE call as well.<br />
<br />
====Steam Links in Firefox, Chrome, Etc====<br />
To make steam:// urls in your browser connect with steam in wine, there are several things you can do. One involves making steam url-handler keys in gconf, another involves making protocol files for kde, others involve tinkering with desktop files or the Local State file for chromium. These seem to only work in firefox or under certain desktop configurations. One way to do it that works more globally is using mimeo, a tool made by Xyne (an Arch TU) which follows. For another working and less invasive (but firefox-only) way, see the first post [http://ubuntuforums.org/showthread.php?t=433548 here] .<br />
<br />
* Make {{ic| /usr/bin/steam}} with your favorite editor and paste:<br />
<br />
{{bc|<br />
#!/bin/sh<br />
#<br />
# Steam wrapper script<br />
#<br />
exec wine "c:\\program files\\steam\\steam.exe" "$@"<br />
}}<br />
<br />
* Make it executable.<br />
<br />
# chmod +x /usr/bin/steam<br />
<br />
* Install {{AUR|mimeo}} and {{AUR|xdg-utils-mimeo}} from AUR. You will need to replace the existing {{pkg|xdg-utils}} if installed. In XFCE, you will also need {{pkg|xorg-utils}}.<br />
<br />
* Create {{ic|~/.config/mimeo.conf}} with your favorite editor and paste:<br />
<br />
{{bc|<br />
/usr/bin/steam %u<br />
^steam://<br />
}}<br />
<br />
* Lastly, open {{ic|/usr/bin/xdg-open}} in your favorite editor. Go to the {{ic|detectDE()}} section and change it to look as follows:<br />
<br />
{{bc|<nowiki><br />
detectDE()<br />
{<br />
#if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;<br />
#elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;<br />
#elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;<br />
#elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;<br />
#elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde;<br />
#else DE=""<br />
#fi<br />
DE=""<br />
}<br />
</nowiki>}}<br />
<br />
* Restart the browser and you should be good to go. In chromium, you cannot enter a {{ic|steam://}} link in the url box like you can with firefox. The forum link above has a {{ic|steam://open/friends}} link to try if needed.<br />
<br />
{{Note|If you have any problems with file associations after doing this, simply revert to regular xdg-utils and undo your changes to {{ic|/usr/bin/xdg-open}}.}}<br />
{{Note|Those on other distributions that stumble upon this page, see the link above for firefox specific instructions. No easy way to get it working on Chromium on other distros exists.}}<br />
<br />
====No text rendered problem====<br />
If there is no text/font rendered when starting steam you should try to start steam with the parameter {{ic|-no-dwrite}}. Read more in [https://bbs.archlinux.org/viewtopic.php?id=146223 the forum thread about it.]<br />
{{bc|wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe -no-dwrite}}</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Media_Transfer_Protocol&diff=235286
Media Transfer Protocol
2012-11-14T02:53:44Z
<p>Teratomata: </p>
<hr />
<div>[[Category:Sound]]<br />
MTP is the "Media Transfer Protocol" and is used by many MP3 players such as the Creative Zen and some Walkmans. In addition, Android phones and tablets use it since version 3.0. It is part of the "Windows Media" Framework and has close relationship with Windows Media Player.<br />
<br />
==Installation==<br />
MTP support is provided by the [http://libmtp.sourceforge.net/ libmtp] package, to install:<br />
pacman -S libmtp<br />
==Usage==<br />
After installation, you have several mtp tools available.<br />
Upon connecting your MTP device, you use:<br />
mtp-detect<br />
to see if your MTP device is detected.<br />
<br />
To connect to your MTP device, you use:<br />
mtp-connect<br />
<br />
If connection is successful, you will be given several switch options in conjunction with mtp-connect to access data on the device.<br />
<br />
There are also several stand alone commands you can use to access your MTP device such as,<br />
{{Note | Some commands may be harmful to your MTP device!!! }}<br />
<br />
mtp-albumart mtp-emptyfolders mtp-getplaylist mtp-reset mtp-trexist<br />
mtp-albums mtp-files mtp-hotplug mtp-sendfile<br />
mtp-connect mtp-folders mtp-newfolder mtp-sendtr<br />
mtp-delfile mtp-format mtp-newplaylist mtp-thumb<br />
mtp-detect mtp-getfile mtp-playlists mtp-tracks<br />
<br />
==Using media players==<br />
You can also use your mtp device in music players such as Amarok. To do this you may have to edit "/etc/udev/rules.d/51-android.rules" (The MTP device used in the following example is a Galaxy Nexus):<br />
To do this run:<br />
$ lsusb<br />
and look for your device, it will be something like:<br />
Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]<br />
in which case the entry would be:<br />
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666"<br />
Then, reload udev rules:<br />
# udevadm control --reload<br />
<br />
{{Note | After installing MTP you may have to reboot for your device to be recognised''}}<br />
<br />
==mtpfs==<br />
Mtpfs is FUSE filesystem that supports reading and writing from any MTP device. Basically it allows you to mount your device as an external drive.<br> It's available in the community repository; you can install it by running {{ic|pacman -S mtpfs}}.<br />
*First edit your {{ic|/etc/fuse.conf}} and uncomment the following line:<br />
user_allow_other<br />
*To mount your device <br />
# mtpfs -o allow_other /media/YOURMOUNTPOINT<br />
*To unmount your device<br />
$ umount /media/YOURMOUNTPOINT<br />
Also, you can put them into your ~/.bashrc:<br />
alias android-connect="mtpfs -o allow_other /media/YOURMOUNTPOINT"<br />
alias android-disconnect="sudo umount /media/YOURMOUNTPOINT"<br />
{{Note|if you want not be asked for password when using sudo, please refer to [[USB Storage Devices#Mounting USB devices]]}}<br />
<br />
==go-mtpfs==<br />
{{Note|Go-mtpfs gives a better performance while writing files to some devices than mtpfs/jmtpfs. Try it if you have slow speeds.}}<br />
If the above instructions don't show any positiv results one should try {{aur|go-mtpfs-git}} from the [[AUR]].<br />
The following has been tested on a Samsung Galaxy Nexus GSM.<br />
<br />
As in the section above install {{aur|android-udev}} which will provide you with "/etc/udev/rules.d/51-android.rules" edit it to apply to <br />
your vendorID and productID, which you can see after running mtp-detect. To the end of the line add with a comma OWNER="yourusername". Save the file.<br />
<br />
*Add yourself to the "fuse" group:<br />
gpasswd -a [user] fuse<br />
<br />
*If the group "fuse" doesn't exist create it with:<br />
groupadd fuse<br />
<br />
Logout or reboot to apply these changes. <br />
<br />
*To create a mount point called "Android" issue the following commands:<br />
mkdir Android<br />
<br />
*To mount your phone use:<br />
go-mtpfs Android<br />
<br />
*To unmount your phone:<br />
fusermount -u Android<br />
<br />
You can create a .bashrc alias as in the example above for easier use.<br />
<br />
==gvfs-mtp==<br />
<br />
Philip Langdale is working on native MTP support for gvfs. Currently gvfs uses gphoto2 for mounting MTP volumes. The weaknesses of gphoto2 and mtpfs are listed in his [http://intr.overt.org/blog/?p=153 blog post]. <br />
*You can test his native mtp implementation for gvfs before it gets upstream with the AUR package [https://aur.archlinux.org/packages.php?ID=62664 gvfs-mtp-git].<br />
<br />
*Devices will have gvfs paths like this<br />
gvfs-ls mtp://[usb:002,013]/<br />
<br />
==KDE MTP KIO Slave==<br />
There is a MTP KIO Slave built upon libmtp under development by Philipp Schmidt, availiable as AUR package [https://aur.archlinux.org/packages.php?ID=63140 kio-mtp-git].<br />
Using KIO makes file access in KDE seamless, in principle any KDE application would be able read/write files on the device.<br />
<br />
===Usage===<br />
The device will be available under the path mtp:/<br />
<br />
===Workaround if the KDE device actions doesn't work===<br />
If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file /usr/share/apps/solid/actions/solid_mtp.desktop<br />
<br />
Change the line<br />
Exec=kioclient exec mtp:udi=%i/<br />
To<br />
Exec=dolphin "mtp:/"<br />
<br />
==Workarounds for Android==<br />
MTP is still buggy and may crash despite the best efforts of developers, and an alternative on Android is to use the app AirDroid for access to files.</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Autofs&diff=210734
Autofs
2012-06-20T17:04:22Z
<p>Teratomata: Added a warning for /- option.</p>
<hr />
<div>[[Category:File systems]]<br />
[[es:Autofs]]<br />
[[it:Autofs]]<br />
[[ru:Autofs]]<br />
[[uk:Autofs]]<br />
{{Article summary start}}<br />
{{Article summary text|This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.}}<br />
{{Article summary end}}<br />
<br />
== Introduction ==<br />
This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.<br />
<br />
== Installation ==<br />
*Install the {{Pkg|autofs}} package:<br />
# pacman -S autofs<br />
<br />
*Load the {{ic|autofs4}} module as root:<br />
# modprobe autofs4<br />
<br />
== Configuration ==<br />
AutoFS uses template files for configuration which are located in {{ic|/etc/autofs}} The main template is called {{ic|auto.master}}, which can point to one or more other templates for specific media types.<br />
<br />
* Open the file {{ic|/etc/autofs/auto.master}} with your favorite editor, you will see something similar to this:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/var/autofs/misc /etc/autofs/auto.misc<br />
/var/autofs/net /etc/autofs/auto.net<br />
<br />
}}<br />
<br />
The first value on each line determines the base directory under which all the media in a template are mounted, the second value is which template to use. The default base path is {{ic|/var/autofs}}, but you can change this to any other location you prefer. For instance:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/media/misc /etc/autofs/auto.misc --timeout=5 --ghost<br />
/media/net /etc/autofs/auto.net --timeout=60 --ghost<br />
<br />
}}<br />
{{Note|Make sure there is an empty line on the end of template files (press {{Keypress|ENTER}} after last word). If there is no correct EOF line, the AutoFS daemon won't properly load.}}<br />
<br />
The optional parameter {{ic|timeout}} sets the amount of seconds after which to unmount directories. The parameter {{ic|ghost}} determines that configured mounts will always be shown, instead of only when they are inserted and accessed. This can be useful since you won't have to remember or guess the names of removable media and network shares.<br />
<br />
The base directory will be created if it does not exist on your system. The base directory will be mounted on to load the dynamically loaded media, which means any content in the base directory will not be accessible while autofs is on. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in {{ic|auto.master}} and restart AutoFS to regain the original contents.<br />
<br />
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links.<br />
<br />
# ln -s /var/autofs/net/share_name /media/share_name<br />
<br />
Alternatively, you can have autofs mount your media to a specific folder, rather than inside a common folder.<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/- /etc/autofs/auto.template<br />
}}<br />
{{hc|/etc/autofs/auto.template|2=<br />
/path/to/folder -options :/device/path<br />
/home/user/usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
}}<br />
{{Note|This can cause problems with resources getting locked if the connection to the share is lost. When trying to access the folder, programs will get locked into waiting for a response, and either the connection has to be restored or the process has to be forcibly killed before unmounting is possible. To mitigate this, only use if you will always be connected to the share, and don't use your home folder or other commonly used folders lest your file browser reads ahead into the disconnected folder}}<br />
<br />
* Open the file {{ic|/etc/nsswitch.conf}} and add an entry for automount:<br />
automount: files<br />
<br />
* When you are done configuring your templates (see below), launch the AutoFS daemon as root:<br />
# rc.d start autofs<br />
<br />
To start the daemon on boot you can add {{ic|autofs}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, and {{ic|autofs4}} to the modules array in the same file.<br />
<br />
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.<br />
<br />
=== Removable media ===<br />
* Open {{ic|/etc/autofs/auto.misc}} to add, remove or edit miscellaneous devices. For instance:<br />
<br />
{{hc|/etc/autofs/auto.misc|<nowiki><br />
#kernel -ro ftp.kernel.org:/pub/linux<br />
#boot -fstype=ext2 :/dev/hda1<br />
usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
cdrom -fstype=iso9660,ro :/dev/cdrom<br />
#floppy -fstype=auto :/dev/fd0<br />
</nowiki>}}<br />
<br />
If you have a CD/DVD combo-drive you can change the {{ic|cdrom}} line with {{ic|-fstype<nowiki>=</nowiki>auto}} to have the media type autodetected.<br />
<br />
=== NFS Network mounts ===<br />
<br />
AutoFS provides a new way of automatically discovering and mounting [[NFS]]-shares on remote servers (the AutoFS network template in {{ic|/etc/autofs/auto.net}} has been removed in autofs5). To enable automagic discovery and mounting of network shares from all accessible servers without any further configuration, you'll need to add the following to the {{ic|/etc/autofs/auto.master}} file:<br />
<br />
/net -hosts --timeout=60<br />
<br />
'''Each host name needs to be resolveable, e.g. the name an IP address in {{ic|/etc/hosts}} or via [[Wikipedia:Domain_Name_System|DNS]] and please make sure you have at least {{Pkg|nfs-common}} installed and working.'''<br />
<br />
For instance, if you have a remote server ''fileserver'' with an NFS share named ''/home/share'', you can just access the share by typing:<br />
<br />
# cd /net/fileserver/home/share<br />
<br />
{{Note|Please note that ''ghosting'', i.e. automatically creating directory placeholders before mounting shares is enabled by default, although AutoFS installation notes claim to remove that option from {{ic|/etc/conf.d/autofs}} in order to start the AutoFS daemon.}}<br />
<br />
The {{ic|-hosts}} option uses a similar mechanism as the {{ic|showmount}} command to detect remote shares. You can see the exported shares by typing:<br />
<br />
# showmount <servername> -e <br />
<br />
Replacing ''<servername>'' with the name of your own server.<br />
<br />
=== Samba ===<br />
<br />
The Arch package does not provide any [[Samba]] or CIFS templates/scripts (23.07.2009), but the following should work for single shares:<br />
<br />
add the following to {{ic|/etc/autofs/auto.master}}<br />
/media/[my_server] /etc/autofs/auto.[my_server]<br />
and then create a file {{ic|/etc/autofs/auto.[my_server]}}<br />
[any_name] -fstype=cifs,[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
You can specify a user name and password to use with the share in the other_options section<br />
[any_name] -fstype=cifs,username=[username],password=[password],[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
{{Note|Escape &#36;, and other characters, with a backslash when neccessary.}}<br />
<br />
=== FTP and SSH (with Fuse) ===<br />
<br />
Remote FTP and [[SSH]] servers can be accessed seamlessly with AutoFS using [[Wikipedia:FUSE|FUSE]], a virtual file system layer. <br />
<br />
==== Remote FTP ====<br />
First, install the {{Pkg|curlftpfs}} package from the Community repository:<br />
<br />
# pacman -S curlftpfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot.<br />
<br />
Next, add a new entry for FTP servers in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/media/ftp /etc/autofs/auto.ftp --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ftp}} and add a server using the {{ic|ftp://myuser:mypassword@host:port/path}} format:<br />
<br />
servername -fstype=curl,rw,allow_other,nodev,nonempty,noatime :ftp\://myuser\:mypassword\@remoteserver<br />
<br />
{{Note| Your passwords are plainly visible for anyone that can run {{ic|df}} (only for mounted servers) or view the file {{ic|/etc/autofs/auto.ftp}}.}}<br />
If you want slightly more security you can create the file {{ic|~root/.netrc}} and add the passwords there. <br />
Passwords are still plain text, but you can have mode 600, and {{ic|df}} command will not show them (mounted or not).<br />
This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:<br />
<br />
machine remoteserver <br />
login myuser<br />
password mypassword<br />
<br />
The line in {{ic|/etc/autofs/auto.ftp}} looks like this without user and password:<br />
<br />
servername -fstype=curl,allow_other :ftp\://remoteserver<br />
<br />
Create the file {{ic|/sbin/mount.curl}} with this code:<br />
<br />
{{hc|/sbin/mount.curl|<nowiki><br />
#! /bin/sh<br />
curlftpfs $1 $2 -o $4,disable_eprt<br />
</nowiki>}}<br />
<br />
Create the file {{ic|/sbin/umount.curl}} with this code:<br />
<br />
{{hc|/sbin/umount.curl|<nowiki><br />
#! /bin/sh<br />
fusermount -u $1<br />
</nowiki>}}<br />
<br />
Set the permissions for both files:<br />
<br />
# chmod 755 /sbin/mount.curl<br />
# chmod 755 /sbin/umount.curl<br />
<br />
After a restart your new FTP server should be accessible through {{ic|/media/ftp/servername}}.<br />
<br />
==== Remote SSH ====<br />
These are basic instructions to access a remote filesystem over [[SSH]] with AutoFS. <br />
<br />
{{Note|The example below does not use an ssh-passphrase to simplify the installation procedure, please note that this may be a security risk in case your local system gets compromised.}}<br />
<br />
Install the {{Pkg|sshfs}} package from the Extra repository:<br />
<br />
# pacman -S sshfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot:<br />
<br />
Install OpenSSH:<br />
# pacman -S openssh<br />
<br />
Generate an [[Using SSH Keys|SSH keypair]]:<br />
# ssh-keygen -t dsa<br />
<br />
When the generator ask for a passphrase, just press {{Keypress|ENTER}}. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article. <br />
<br />
Next, copy the public key to the remote SSH server:<br />
# ssh-copy-id -i /home/username/.ssh/id_dsa.pub username@remotehost<br />
<br />
See that you can login to the remote server without entering a password:<br />
# sudo ssh -i /home/username/.ssh/id_dsa username@remotehost<br />
<br />
{{Note|The above command is needed to add the remote server to the root's list of {{ic|known_hosts}}. Alternatively, hosts can be added to {{ic|/etc/ssh/ssh_known_hosts}}.}}<br />
<br />
Create a new entry for SSH servers in {{ic|/etc/autofs/auto.master}}:<br />
/media/ssh /etc/autofs/auto.ssh --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ssh}} and add an SSH server:<br />
{{hc|/etch/autofs/auto.ssh|2=<br />
servername -fstype=fuse,rw,allow_other,IdentityFile=/home/username/.ssh/id_dsa :sshfs\#username@host\:/<br />
}}<br />
<br />
After a restart your SSH server should be accessible through {{ic|/media/ssh/servername}}.<br />
<br />
== Troubleshooting and tweaks ==<br />
This section contains a few solutions for common issues with AutoFS.<br />
<br />
=== Using NIS ===<br />
<br />
Version 5.0.5 of AutoFS has more advanced support for [[NIS]]. To use AutoFS together with NIS, add {{ic|yp:}} in front of the template names in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/home yp:auto_home --timeout=60 <br />
/sbtn yp:auto_sbtn --timeout=60<br />
+auto.master<br />
<br />
On earlier versions of NIS (before 5.0.4), you should add {{ic|nis}} to {{ic|/etc/nsswitch.conf}}:<br />
automount: files nis<br />
<br />
=== Optional parameters ===<br />
You can set parameters like {{ic|timeout}} systemwide for all AutoFS media in {{ic|/etc/conf.d/autofs}}:<br />
<br />
* Open the {{ic|/etc/conf.d/autofs}} file and edit the {{ic|daemonoptions}} line:<br />
daemonoptions='--timeout=5'<br />
<br />
* To enable logging (default is no logging at all), add {{ic|--verbose}} to the {{ic|daemonoptions}} line in {{ic|/etc/conf.d/autofs}} e.g.:<br />
daemonoptions='--verbose --timeout=5'<br />
<br />
After restarting the {{ic|autofs}} daemon, verbose output is visible in {{ic|/var/log/daemon.log}}.<br />
<br />
=== Identify multiple devices ===<br />
If you use multiple USB drives/sticks and want to easily tell them apart, you can use AutoFS to set up the mount points and [[Udev]] to create distinct names for your USB drives. See [[Map Custom Device Entries with udev]] for instructions on setting up Udev rules.<br />
<br />
=== AutoFS permissions ===<br />
If AutoFS isn't working for you, make sure that the permissions of the templates files are correct, otherwise AutoFS will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:<br />
<br />
*0644 - /etc/autofs/auto.master<br />
*0644 - /etc/autofs/auto.media<br />
*0644 - /etc/autofs/auto.misc<br />
*0644 - /etc/conf.d/autofs<br />
<br />
In general, scripts (like previous {{ic|auto.net}}) should have executable ({{ic|chown a+x filename}}) bits set and lists of mounts shouldn't.<br />
<br />
If you are getting errors in {{ic|/var/log/daemon.log}} similar to this, you have a permissions problem:<br />
<br />
May 7 19:44:16 peterix automount[15218]: lookup(program): lookup for petr failed<br />
May 7 19:44:16 peterix automount[15218]: failed to mount /media/cifs/petr<br />
<br />
==See also==<br />
* FTP and SFTP usage with AutoFS is based on this Gentoo Wiki article: http://en.gentoo-wiki.com/wiki/Mounting_SFTP_and_FTP_shares<br />
* More information on SSH can be found on the [[SSH]] and [[Using_SSH_Keys|Using SSH Keys]] pages of this wiki.<br />
* Information on setting up NFS can be found here: [[NFS]]<br />
<br />
== Alternatives to AutoFS ==<br />
*[[Thunar#Thunar_Volume_Manager|Thunar Volume Manager]] is an automount system for users of the [[Thunar]] file manager.<br />
* Pcmanfm-fuse is a lightweight file manager with built-in support for accessing remote shares: https://aur.archlinux.org/packages.php?ID=22992<br />
* [[udiskie]] is a minimalistic automatic disk mounting service using udisks</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Fonts&diff=203802
Fonts
2012-06-06T00:19:59Z
<p>Teratomata: /* Unsorted */</p>
<hr />
<div>[[Category:Fonts]]<br />
[[Category:Graphics and desktop publishing]]<br />
[[tr:Yazıtipleri]]<br />
{{i18n|Fonts}}<br />
{{expansion}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Covers the selection and installation of fonts on Arch Linux}}<br />
{{Article summary heading|Legal}}<br />
{{Article summary text|Certain font licenses may impose some legal limitations}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Font Configuration}}: Font setup and beautification<br />
{{Article summary wiki|Java Runtime Environment Fonts}}: Fonts specific to Sun's Java machine<br />
{{Article summary wiki|MS Fonts}}: Adding Microsoft fonts and mimicking Windows' font settings<br />
{{Article summary end}}<br />
<br />
== Font formats ==<br />
<br />
Most computer fonts used today are in either ''bitmap'' or ''outline'' data formats. Bitmap fonts store fixed images for each glyph in each typeface and point size. Outline or ''vector'' fonts store characters as instructions for drawing each glyph's lines and curves. Outline fonts scale smoothly in size over a wide range.<br />
<br />
Common font filename extensions include:<br />
<br />
* {{ic|bdf}} and {{ic|bdf.gz}} – bitmap fonts, ''b''itmap ''d''istribution ''f''ormat and gzip compressed {{ic|bdf}}<br />
* {{ic|pcf}} and {{ic|pcf.gz}} – bitmaps, ''p''ortable ''c''ompiled ''f''ont and gzip compressed {{ic|pcf}}<br />
* {{ic|psf}}, {{ic|psfu}}, {{ic|psf.gz}} and {{ic|psfu.gz}} – bitmaps, ''P''C ''s''creen ''f''ont, ''P''C ''s''creen ''f''ont ''U''nicode and the gzipped versions (not compatible with Xorg)<br />
* {{ic|pfa}} and {{ic|pfb}} – outline fonts, ''P''ostScript ''f''ont ''A''SCII and ''P''ostScript ''f''ont ''b''inary. PostScript fonts carry built-in printer instructions.<br />
* {{ic|ttf}} – outline, ''T''rue''T''ype ''f''ont. Originally designed as a replacement for the PostScript fonts.<br />
* {{ic|otf}} – outline, ''O''pen''T''ype ''f''ont. TrueType with PostScript typographic instructions.<br />
<br />
For most purposes, the technical differences between TrueType and OpenType can be ignored, some fonts with a {{ic|ttf}} extension are actually OpenType fonts.<br />
<br />
=== Other formats ===<br />
<br />
The typesetting application, ''TeX,'' and its companion font software, ''Metafont,'' render characters using their own methods. Some of the file extensions used for fonts by these two programs are {{ic|*pk}}, {{ic|*gf}}, {{ic|mf}} and {{ic|vf}}.<br />
<br />
''FontForge,'' a font editing application, can store fonts in its native text-based format, {{ic|sfd}}, ''s''pline ''f''ont ''d''atabase.<br />
<br />
The [http://www.w3.org/TR/SVG/fonts.html SVG] format also has its own font description method.<br />
<br />
== Installation ==<br />
<br />
Various methods of installing fonts.<br />
<br />
=== Pacman ===<br />
<br />
Fonts and font collections in the enabled repositories can be installed using [[Pacman|pacman]]. Available fonts may be found by using:<br />
$ pacman -Ss font<br />
Or to search for {{ic|ttf}} fonts only:<br />
$ pacman -Ss ttf<br />
<br />
Some fonts like <i>terminus</i> are installed in {{ic|/usr/share/fonts/local}}, which is not added to the font path by default. By adding the following lines to {{ic|~/.xinitrc}}<br />
{{bc|<br />
xset +fp /usr/share/fonts/local<br />
xset fp rehash<br />
}}<br />
the fonts can be used in X11.<br />
<br />
=== Creating a package ===<br />
<br />
If you want to give pacman the ability to manage your fonts, you can create an Arch package. These can also be shared with the community in the [[AUR]]. Here is an example of how to create a basic package. To learn more about building packages, read [[PKGBUILD]].<br />
<br />
{{bc|<nowiki><br />
pkgname=ttf-fontname<br />
pkgver=1.0<br />
pkgrel=1<br />
depends=('fontconfig' 'xorg-font-utils')<br />
pkgdesc="custom fonts"<br />
arch=('any')<br />
source=(http://someurl.org/$pkgname.tar.bz2)<br />
install=$pkgname.install<br />
<br />
build()<br />
{<br />
mkdir -p $pkgdir/usr/share/fonts/TTF<br />
cp $srcdir/$pkgname/*.ttf $pkgdir/usr/share/fonts/TTF<br />
}<br />
</nowiki>}}<br />
<br />
This PKGBUILD assumes the fonts are TrueType. An install file ({{ic|ttf-fontname.install}}) will also need to be created to update the font cache:<br />
<br />
{{bc|<nowiki><br />
post_install() {<br />
echo -n "Updating font cache... "<br />
fc-cache -fs >/dev/null<br />
mkfontscale /usr/share/fonts/TTF /usr/share/fonts/Type1<br />
mkfontdir /usr/share/fonts/TTF /usr/share/fonts/Type1<br />
echo "done"<br />
}<br />
<br />
post_upgrade() {<br />
post_install<br />
}<br />
</nowiki>}}<br />
<br />
=== Manual installation ===<br />
<br />
The recommended way of adding fonts to your system that are not in the repositories is described in [[#Creating a package]]. This gives pacman the ability to be able to remove or update them at a later time. Fonts can alternately be installed manually as well.<br />
<br />
To install fonts system-wide (available for all users), move the folder to the {{ic|/usr/share/fonts/}} directory. To install fonts for only a single user, use {{ic|~/.fonts/}} instead.<br />
<br />
Also you may need to update {{ic|/etc/X11/xorg.conf}} or {{ic|/etc/xorg.conf}} with the new directory. Search for {{ic|FontPath}} to find the correct location within the file to add your new path. See [[#Fonts with Xorg]] for more detail.<br />
<br />
Then update the fontconfig font cache:<br />
<br />
$ fc-cache -vf<br />
<br />
==== Older applications ====<br />
<br />
With older applications that do not support fontconfig (e.g. GTK1 applications, and {{ic|xfontsel}}) the index will need to be created in the font directory:<br />
<br />
$ mkfontscale<br />
$ mkfontdir<br />
<br />
Or to include more than one folder with one command:<br />
<br />
$ for dir in /font/dir1/ /font/dir2/; do xset +fp $dir; done && xset fp rehash<br />
<br />
At times the X server may fail to load the fonts directory and you will need to rescan all the {{ic|fonts.dir}} files:<br />
<br />
# xset +fp /usr/share/fonts/misc # Inform the X server of new directories<br />
# xset fp rehash # Forces a new rescan<br />
<br />
To check that the font(s) is included:<br />
<br />
$ xlsfonts | grep fontname<br />
<br />
=== Pango Warnings ===<br />
When [http://www.pango.org/ Pango] is in use on your system it will read from [http://fontconfig.org/wiki/ fontconfig] to sort out where to source fonts.<br />
<br />
(process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'<br />
(process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin'<br />
<br />
If you are seeing errors similar to this and/or seeing blocks instead of characters in your application then you need to add fonts and update the font cache. This example uses the {{Pkg|ttf-liberation}} fonts to illustrate the solution and runs as root to enable them system-wide.<br />
<br />
# pacman -S ttf-liberation<br />
-- output abbreviated, assumes installation succeeded -- <br />
<br />
# fc-cache -vfs<br />
/usr/share/fonts: caching, new cache contents: 0 fonts, 3 dirs<br />
/usr/share/fonts/TTF: caching, new cache contents: 16 fonts, 0 dirs<br />
/usr/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs<br />
/usr/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs<br />
/usr/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs<br />
/var/cache/fontconfig: cleaning cache directory <br />
fc-cache: succeeded<br />
<br />
You can test for a default font being set like so:<br />
<br />
# fc-match<br />
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"<br />
<br />
=== Fonts with Xorg ===<br />
<br />
In order for [[Xorg]] to find and use your newly installed fonts, you must add the font paths to {{ic|/etc/X11/xorg.conf}} (another Xorg configuration file may work too).<br />
<br />
Here is an example of the section that must be added to {{ic|/etc/X11/xorg.conf}}. Add or remove paths based on your particular font requirements.<br />
# Let Xorg know about the custom font directories<br />
Section "Files"<br />
FontPath "/usr/share/fonts/100dpi"<br />
FontPath "/usr/share/fonts/75dpi"<br />
FontPath "/usr/share/fonts/cantarell"<br />
FontPath "/usr/share/fonts/cyrillic"<br />
FontPath "/usr/share/fonts/encodings"<br />
FontPath "/usr/share/fonts/local"<br />
FontPath "/usr/share/fonts/misc"<br />
FontPath "/usr/share/fonts/OTF"<br />
FontPath "/usr/share/fonts/TTF"<br />
FontPath "/usr/share/fonts/util"<br />
EndSection<br />
<br />
==Font packages==<br />
This is a selective list that includes many font packages from the [[AUR]] along with those in the official repositories. Fonts are tagged "Unicode" if they have wide Unicode support, see the project or Wikipedia pages for detail.<br />
<br />
===Braille===<br />
*{{Pkg|ttf-ubraille}} - Font containing Unicode symbols for ''braille''<br />
<br />
===International users===<br />
<br />
====Arabic====<br />
*{{AUR|ttf-sil-lateef}} - Unicode Arabic font from SIL ''(AUR)''<br />
*{{AUR|ttf-sil-scheherazade}} - Unicode Arabic font from SIL ''(AUR)''<br />
*{{AUR|ttf-arabeyes-fonts}} - Collection of free Arabic fonts ''(AUR)''<br />
<br />
====Birman====<br />
*{{AUR|ttf-myanmar3}} - Font for Myanmar/Burmese script ''(AUR)''<br />
<br />
====Chinese, Japanese, Korean, Vietnamese====<br />
<br />
=====(Mainly) Chinese=====<br />
*{{AUR|ttf-tw}} - Kai and Song traditional Chinese font from the Ministry of Education of Taiwan ''(AUR)''.<br />
*{{AUR|wqy-microhei}} - A Sans-Serif style high quality CJK outline font. ''(AUR)''<br />
*{{Pkg|wqy-zenhei}} - Hei Ti Style (sans-serif) Chinese Outline font embedded with bitmapped Song Ti (also supporting Japanese (partial) and Korean characters).<br />
*{{Pkg|ttf-arphic-ukai}} - ''Kaiti'' (brush stroke) Unicode font (enabling anti-aliasing is suggested)<br />
*{{Pkg|ttf-arphic-uming}} - ''Mingti'' (printed) Unicode font<br />
*{{Pkg|opendesktop-fonts}} - ''New Sung'' font, previously is ttf-fireflysung package<br />
*{{Pkg|wqy-bitmapfont}} - Bitmapped Song Ti (serif) Chinese font<br />
*{{Pkg|ttf-hannom}} - Chinese and Vietnamese TrueType font<br />
<br />
=====Japanese=====<br />
*{{AUR|otf-ipafont}} - Formal style Japanese Gothic (san-serif) and Mincho (serif) fonts set; one of the highest quality open source font. Default of openSUSE-ja. ''(AUR)''<br />
*{{AUR|ttf-vlgothic}} - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux ''(AUR)''<br />
*{{AUR|ttf-mplus}} - Modern Gothic style Japanese outline fonts. It includes all of Japanese Hiragana/Katakana, Basic Latin, Latin-1 Supplement, Latin Extended-A, IPA Extensions and most of Japanese Kanji, Greek, Cyrillic, Vietnamese with 7 weights (proportional) or 5 weights (monospace).<br />
*{{AUR|ttf-ipa-mona}}, {{AUR|ttf-monapo}} - Japanese fonts to show [http://en.wikipedia.org/wiki/2channel_Shift_JIS_art 2channel Shift JIS art] properly. ''(AUR)''<br />
*{{Pkg|ttf-sazanami}} - Japanese free TrueType font. This is outdated and not maintained any more, but may be defined as a fallback font on several environment.<br />
<br />
=====Korean=====<br />
*{{Pkg|ttf-baekmuk}} - Collection of Korean TrueType fonts<br />
*{{AUR|ttf-alee}} - Set of free Hangul TrueType fonts ''(AUR)''<br />
*{{AUR|ttf-unfonts-core}} - Un fonts (default Baekmuk fonts may be unsatisfactory) (''AUR'')<br />
<br />
====Cyrillic====<br />
''Also see [[#Monospace]], [[#Sans]] and [[#Serif]]''<br />
*{{AUR|font-arhangai}} - Mongolian Cyrillic (''AUR'')<br />
*{{AUR|ttf-pingwi-typography}} - PingWi Typography (PWT) fonts (''AUR'')<br />
<br />
====Greek====<br />
Almost all Unicode fonts contain the Greek character set (polytonic included). Some additional font packages, which might not be contain the complete Unicode set but utilize high quality Greek (and Latin, of course) typefaces are:<br />
*{{AUR|otf-gfs}} - Selection of OpenType fonts from the Greek Font Society ''(AUR)''<br />
*{{AUR|ttf-mgopen}} - Professional TrueType fonts from Magenta ''(AUR)''<br />
<br />
====Hebrew====<br />
*{{AUR|culmus}} - Nice collection of free Hebrew fonts<br />
<br />
====Indic====<br />
*{{Pkg|ttf-freebanglafont}} - Font for Bangla<br />
*{{Pkg|ttf-indic-otf}} - Indic OpenType Fonts collection (containing ttf-freebanglafont)<br />
:(This one contains a ಠ_ಠ "look of disapproval" that might be more to your liking than the {{Pkg|bdf-unifont}} one mentioned elsewhere in this document)<br />
* {{Pkg|lohit-font}} - Indic TrueType fonts from Fedora Project (containing Oriya Fonts and more) ''(AUR)''<br />
<br />
====Khmer====<br />
*{{Pkg|ttf-khmer}} - Font covering glyphs for Khmer language<br />
*[http://code.google.com/webfonts/family?family=Hanuman&subset=khmer Hanuman] ({{AUR|ttf-google-webfonts}})<br />
<br />
====Sinhala====<br />
*{{AUR|ttf-lklug}} - Sinhala Unicode font (''AUR'')<br />
<br />
====Tamil====<br />
*{{AUR|ttf-tamil}} - Tamil Unicode fonts (''AUR'')<br />
<br />
====Thai====<br />
*{{Pkg|ttf-thai}} - Font covering glyphs for Thai<br />
====Tibetan====<br />
*{{Pkg|ttf-tibetan-machine}} - Tibetan Machine TTFont<br />
<br />
===Math===<br />
*{{Pkg|font-mathematica}} - Mathematica fonts by Wolfram Research, Inc.<br />
*{{AUR|ttf-mathtype}} - MathType fonts ''(AUR)''<br />
*{{AUR|ttf-computer-modern-fonts}} - ''(AUR)''<br />
<br />
===Microsoft fonts===<br />
See [[MS Fonts]].<br />
<br />
===Monospaced===<br />
Here are some suggestions. Every user has their own favorite, so experiment to find yours. <br />
If you're in a hurry, you read Dan Benjamin's blog post: [http://hivelogic.com/articles/top-10-programming-fonts ''Top 10 Programming Fonts''].<br />
<br />
Here's a long list of fonts by Trevor Lowing: http://www.lowing.org/fonts/<br />
<br />
====TrueType====<br />
*[[Wikipedia:Andalé Mono|Andalé Mono]] ({{AUR|ttf-ms-fonts}})<br />
*Anka/Coder ({{AUR|ttf-anka-coder}})<br />
*Anonymous Pro ({{AUR|ttf-anonymous-pro}}, included in {{AUR|ttf-google-webfonts}})<br />
*[[Wikipedia:Bitstream Vera|Bitstream Vera Mono]] ({{Pkg|ttf-bitstream-vera}})<br />
*[[Wikipedia:Consolas|Consolas]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Courier New|Courier New]] ({{AUR|ttf-ms-fonts}})<br />
*Cousine ({{AUR|ttf-google-webfonts}}) - Chrome/Chromium OS replacement for Courier New (metric-compatible)<br />
*[[Wikipedia:DejaVu fonts|DejaVu Sans Mono]] ({{Pkg|ttf-dejavu}}) - Unicode<br />
*[[Wikipedia:Droid (font)|Droid Sans Mono]] ({{Pkg|ttf-droid}}, included in {{AUR|ttf-google-webfonts}})<br />
*Envy Code R ({{AUR|ttf-envy-code-r}})<br />
*[[Wikipedia:GNU FreeFont|FreeMono]] ({{Pkg|ttf-freefont}}) - Unicode<br />
*[[Wikipedia:Inconsolata|Inconsolata]] ({{Pkg|ttf-inconsolata}})<br />
*[[Wikipedia:Inconsolata|Inconsolata-g]] ({{AUR|ttf-inconsolata-g}}) - adds some programmer-friendly modifications<br />
*[[Wikipedia:Liberation fonts|Liberation Mono]] ({{Pkg|ttf-liberation}}) - Alternative to Courier New (metric-compatible)<br />
*[[Wikipedia:Lucida Console|Lucida Console]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Lucida Typewriter|Lucida Typewriter]] (included in package {{Pkg|jre}})<br />
*[[Wikipedia:Monaco (typeface)|Monaco]] ({{Pkg|monaco-linux-font}})<br />
*Monofur ({{AUR|ttf-monofur}})<br />
<br />
====Bitmap====<br />
*Default 8x16<br />
*Dina ({{Pkg|dina-font}})<br />
*Lime ({{Pkg|artwiz-fonts}})<br />
*[[Wikipedia:ProFont|ProFont]] ({{Pkg|profont}})<br />
*[[Wikipedia:Proggy Programming Fonts|Proggy Programming Fonts]] ({{AUR|proggyfonts}})<br />
*Proggy opti cyrillic ({{AUR|proggyopticyr-font}})<br />
*Tamsyn ({{AUR|tamsyn-font}})<br />
*[[Wikipedia:Terminus (typeface)|Terminus]] ({{Pkg|terminus-font}})<br />
*Unifont (glyphs like ಠ_ಠ (look of disapproval)) ({{Pkg|bdf-unifont}})<br />
<br />
===Sans-serif===<br />
<br />
*[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=andika Andika] ({{AUR|ttf-andika}}, included in {{AUR|ttf-sil-fonts}})<br />
*[[Wikipedia:Arial|Arial]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Arial Black|Arial Black]] ({{AUR|ttf-ms-fonts}})<br />
*Arimo ({{AUR|ttf-google-webfonts}}) - Chrome/Chromium OS replacement for Arial (metric-compatible)<br />
*[[Wikipedia:Calibri|Calibri]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Candara|Candara]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Constantia (typeface)|Constantia]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Corbel (typeface)|Corbel]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:DejaVu fonts|DejaVu Sans]] ({{Pkg|ttf-dejavu}}) - Unicode<br />
*[[Wikipedia:Droid (font)|Droid Sans]] ({{Pkg|ttf-droid}}, included in {{AUR|ttf-google-webfonts}})<br />
*[[Wikipedia:GNU FreeFont|FreeSans]] ({{Pkg|ttf-freefont}}) - Unicode<br />
*[[Wikipedia:Impact (typeface)|Impact]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Liberation fonts|Liberation Sans]] ({{Pkg|ttf-liberation}}, improved/reworked Cyrillic: {{Pkg|ttf-liberastika}}) - Alternative to Arial (metric-compatible)<br />
*[[Wikipedia:Liberation fonts|Liberation Sans Narrow]] ({{Pkg|ttf-liberation}}) - Alternative to Arial Narrow (metric-compatible)<br />
*[[Wikipedia:Linux Libertine|Linux Biolinum]] ({{Pkg|ttf-linux-libertine}})<br />
*[[Wikipedia:Lucida Sans|Lucida Sans]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Microsoft Sans Serif|Microsoft Sans Serif]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:PT Sans|PT Sans]] ({{AUR|ttf-google-webfonts}}) - 3 major variations: normal, narrow, and caption - Unicode: Latin, Cyrillic<br />
*[[Wikipedia:Tahoma (typeface)|Tahoma]] ({{AUR|ttf-tahoma}})<br />
*[[Wikipedia:Trebuchet MS|Trebuchet]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Ubuntu-Title|Ubuntu-Title]] ({{AUR|ttf-ubuntu-title}})<br />
*[[Wikipedia:Ubuntu Font Family|Ubuntu Font Family]] ({{Pkg|ttf-ubuntu-font-family}})<br />
*[[Wikipedia:Verdana|Verdana]] ({{AUR|ttf-ms-fonts}})<br />
<br />
===Script===<br />
<br />
*[[Wikipedia:Comic Sans|Comic Sans]] ({{AUR|ttf-ms-fonts}})<br />
<br />
===Serif===<br />
*[[Wikipedia:Cambria (typeface)|Cambria]] ({{AUR|ttf-vista-fonts}})<br />
*[[Wikipedia:Charis SIL|Charis]] ({{AUR|ttf-charis}}, included in {{AUR|ttf-sil-fonts}}) - Unicode: Latin, Cyrillic<br />
*[[Wikipedia:DejaVu fonts|DejaVu Serif]] ({{Pkg|ttf-dejavu}}) - Unicode<br />
*[[Wikipedia:Doulos SIL|Doulos]] ({{AUR|doulos-sil}}, included in {{AUR|ttf-sil-fonts}}) - Unicode: Latin, Cyrillic<br />
*[[Wikipedia:Droid (font)|Droid Serif]] ({{Pkg|ttf-droid}}, included in {{AUR|ttf-google-webfonts}})<br />
*[[Wikipedia:GNU FreeFont|FreeSerif]] ({{Pkg|ttf-freefont}}) - Unicode<br />
*[[Wikipedia:Gentium|Gentium]] ({{Pkg|ttf-gentium}}, included in {{AUR|ttf-sil-fonts}}) - Unicode: Latin, Greek, Cyrillic, Phonetic Alphabet<br />
*[[Wikipedia:Georgia (typeface)|Georgia]] ({{AUR|ttf-ms-fonts}})<br />
*[[Wikipedia:Liberation fonts|Liberation Serif]] ({{Pkg|ttf-liberation}}) - Alternative to Times New Roman (metric-compatible)<br />
*[[Wikipedia:Linux Libertine|Linux Libertine]] ({{Pkg|ttf-linux-libertine}}) - Unicode: Latin, Greek, Cyrillic, Hebrew<br />
*[[Wikipedia:Times New Roman|Times New Roman]] ({{AUR|ttf-ms-fonts}})<br />
*Tinos ({{AUR|ttf-google-webfonts}}) - Chrome/Chromium OS replacement for Times New Roman (metric-compatible)<br />
<br />
===Unsorted===<br />
<!--This section should be absorbed into the Monospace/Serif/Sans-Serif structure--><br />
*{{AUR|ttf-google-webfonts}} - a huge collection of free fonts (including ubuntu, inconsolata, droid, etc.) - Note: Your font dialog might get very long as >100 fonts will be added<br />
*{{Pkg|ttf-mph-2b-damase}} - Covers full plane 1 and several scripts<br />
*{{AUR|ttf-symbola}} - Provides emoji and many many other symbols.<br />
*{{AUR|ttf-sil-fonts}} - Gentium, Charis, Doulos, Andika and Abyssinica from SIL ''(AUR)''<br />
*{{Pkg|font-bh-ttf}} - Xorg Luxi fonts<br />
*{{Pkg|ttf-cheapskate}} - Font collection from ''dustismo.com''<br />
*{{Pkg|ttf-isabella}} - Calligraphic font based on the ''Isabella Breviary'' of 1497<br />
*{{Pkg|ttf-junicode}} - Junius font containing almost complete medieval latin script glyphs<br />
*arkpandorafonts {{AUR|ttf-arkpandora}} — Alternative to Arial and Times New Roman fonts<br />
*{{Pkg|xorg-fonts-type1}} — IBM Courier and Adobe Utopia sets of [[Wikipedia:PostScript fonts|PostScript fonts]]<br />
<br />
==Console fonts==<br />
<br />
The console, meaning a terminal running with no ''X'' Window System, uses the ASCII character set as the default. This font and the keymap used are easily changed.<br />
<br />
A console font is limited to either 256 or 512 characters. The fonts are found in {{ic|/usr/share/kbd/consolefonts/}}.<br />
<br />
''Keymaps, ''the connection between the key pressed and the character used by the computer, are found in the subdirectories of {{ic|/usr/share/kbd/keymaps/}}.<br />
<br />
=== Previewing and testing ===<br />
<br />
Unfortunately, no organized library of images is available to preview console fonts. The user can, however, use {{ic|setfont}} to temporarily change the font and be able to consider its use as the default. The available ''glyphs ''or letters in the font can also be viewed as a table with the command {{ic|showconsolefont}}.<br />
<br />
If the newly changed font is not suitable, a return to the default font is done by issuing the command {{ic|setfont}} without any arguments. If the console display is totally unreadable, this command will still work—the user just types in {{ic|setfont}} while "working blind."<br />
<br />
Note that {{ic|setfont}} only works on the console currently being used. Any other consoles, active or inactive, remain unaffected.<br />
<br />
==== Examples ====<br />
<br />
Change the font. This example is distinctive:<br />
$ setfont /usr/share/kbd/consolefonts/gr737b-9x16-medieval.psfu.gz<br />
<br />
Or change the font to one with 512 glyphs and set the keymap to ''ISO 8859-5'' using the {{ic|-m}} option:<br />
$ setfont /usr/share/kbd/consolefonts/LatArCyrHeb-16.psfu.gz -m 8859-5<br />
<br />
Then issue commands that send text to the display, perhaps view a ''manpage'' and try ''vi'' or ''nano'', and view the table of glyphs with the command, {{ic|showconsolefont}}.<br />
<br />
Return to the default font with:<br />
$ setfont<br />
<br />
=== Changing the default font ===<br />
<br />
To change the default font, the {{ic|CONSOLEFONT<nowiki>=</nowiki>}} and {{ic|CONSOLEMAP<nowiki>=</nowiki>}} settings in {{ic|/etc/rc.conf}} must be altered. Again, the fonts can be found in {{ic|/usr/share/kbd/consolefonts/}} directory and keymaps can be found in the subdirectories of {{ic|/usr/share/kbd/keymaps/}}.<br />
<br />
==== Examples ====<br />
For displaying characters such as ''Č, ž, đ, š'' or ''Ł, ę, ą, ś'' using the font {{ic|lat2-16.psfu.gz}}:<br />
CONSOLEFONT="lat2-16"<br />
It means that second part of ISO/IEC 8859 characters are used with size 16. You can change font size using other values like lat2-08...16. For the regions determined by 8859 specification, look at the [http://en.wikipedia.org/wiki/ISO/IEC_8859#The_Parts_of_ISO.2FIEC_8859 Wikipedia]. You can use a Terminus font which is recommended if you work a lot in console without X server. ter-216b for example is latin-2 part, size 16, bold. ter-216n is the same but normal weight. Terminus fonts have sizes up to 32.<br />
<br />
Now, set the proper keymap, for lat2-16 it will be:<br />
CONSOLEMAP="8859-2"<br />
<br />
To use the specified font in early userspace, that is, early in the bootup process, add the {{ic|consolefont}} hook to {{ic|/etc/mkinitcpio.conf}}:<br />
HOOKS="base udev autodetect pata scsi sata filesystems '''consolefont''' '''keymap'''"<br />
<br />
Then rebuild the image:<br />
# mkinitcpio -p linux<br />
<br />
{{Note|The above steps must be repeated for each kernel if more than one kernel package is installed.}}<br />
<br />
See [[Mkinitcpio#HOOKS]] for more information.<br />
<br />
==== Boot Error ====<br />
<br />
If "Loading Console Font" fails at boot time, this is probably because you didn't choose a valid font during your archlinux install.<br />
<br />
To get rid of this message, simply empty the CONSOLEFONT var in /etc/rc.conf (CONSOLEFONT=). It will fallback on default font at boot.<br />
<br />
== Fallback font order with X11 ==<br />
Fontconfig automatically chose a font that match the current requirement. That is to say, if one is looking at a window containing English and Chinese for example, it will switch to another font for the Chinese text if the default one doesn't support it.<br />
<br />
Fontconfig lets every user config the order they want thanks to {{ic|~/.fonts.conf}}.<br />
If you want a particular Chinese font to be selected after your favorite Serif font, your file would look like that:<br />
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<alias><br />
<family>serif</family><br />
<prefer><br />
<family>Your favorite Latin Serif font name</family><br />
<family>Your Chinese font name</family><br />
</prefer><br />
</alias><br />
</fontconfig><br />
<br />
You can add a section for Sans-serif and monospaced as well. For more informations, have a look at the fontconfig manual.</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Autofs&diff=198873
Autofs
2012-04-24T23:11:41Z
<p>Teratomata: fixed auto.misc error</p>
<hr />
<div>[[Category:File systems]]<br />
{{i18n|Autofs}}<br />
{{Article summary start}}<br />
{{Article summary text|This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.}}<br />
{{Article summary end}}<br />
<br />
== Introduction ==<br />
This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.<br />
<br />
== Installation ==<br />
*Install the {{Pkg|autofs}} package:<br />
# pacman -S autofs<br />
<br />
*Load the {{ic|autofs4}} module as root:<br />
# modprobe autofs4<br />
<br />
== Configuration ==<br />
AutoFS uses template files for configuration which are located in {{ic|/etc/autofs}} The main template is called {{ic|auto.master}}, which can point to one or more other templates for specific media types.<br />
<br />
* Open the file {{ic|/etc/autofs/auto.master}} with your favorite editor, you will see something similar to this:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/var/autofs/misc /etc/autofs/auto.misc<br />
/var/autofs/net /etc/autofs/auto.net<br />
<br />
}}<br />
<br />
The first value on each line determines the base directory under which all the media in a template are mounted, the second value is which template to use. The default base path is {{ic|/var/autofs}}, but you can change this to any other location you prefer. For instance:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/media/misc /etc/autofs/auto.misc --timeout=5 --ghost<br />
/media/net /etc/autofs/auto.net --timeout=60 --ghost<br />
<br />
}}<br />
{{Note|Make sure there is an empty line on the end of template files (press {{Keypress|ENTER}} after last word). If there is no correct EOF line, the AutoFS daemon won't properly load.}}<br />
<br />
The optional parameter {{ic|timeout}} sets the amount of seconds after which to unmount directories. The parameter {{ic|ghost}} determines that configured mounts will always be shown, instead of only when they are inserted and accessed. This can be useful since you won't have to remember or guess the names of removable media and network shares.<br />
<br />
The base directory will be created if it does not exist on your system. The base directory will be mounted on to load the dynamically loaded media, which means any content in the base directory will not be accessible while autofs is on. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in {{ic|auto.master}} and restart AutoFS to regain the original contents.<br />
<br />
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links.<br />
<br />
# ln -s /var/autofs/net/share_name /media/share_name<br />
<br />
Alternatively, you can have autofs mount your media to a specific folder, rather than inside a common folder.<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/- /etc/autofs/auto.template<br />
}}<br />
{{hc|/etc/autofs/auto.template|2=<br />
/path/to/folder -options :/device/path<br />
/home/user/usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
}}<br />
<br />
* Open the file {{ic|/etc/nsswitch.conf}} and add an entry for automount:<br />
automount: files<br />
<br />
* When you are done configuring your templates (see below), launch the AutoFS daemon as root:<br />
# rc.d start autofs<br />
<br />
To start the daemon on boot you can add {{ic|autofs}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, and {{ic|autofs4}} to the modules array in the same file.<br />
<br />
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.<br />
<br />
=== Removable media ===<br />
* Open {{ic|/etc/autofs/auto.misc}} to add, remove or edit miscellaneous devices. For instance:<br />
<br />
{{hc|/etc/autofs/auto.misc|<nowiki><br />
#kernel -ro ftp.kernel.org:/pub/linux<br />
#boot -fstype=ext2 :/dev/hda1<br />
usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
cdrom -fstype=iso9660,ro :/dev/cdrom<br />
#floppy -fstype=auto :/dev/fd0<br />
</nowiki>}}<br />
<br />
If you have a CD/DVD combo-drive you can change the {{ic|cdrom}} line with {{ic|-fstype<nowiki>=</nowiki>auto}} to have the media type autodetected.<br />
<br />
=== NFS Network mounts ===<br />
<br />
AutoFS provides a new way of automatically discovering and mounting [[NFS]]-shares on remote servers (the AutoFS network template in {{ic|/etc/autofs/auto.net}} has been removed in autofs5). To enable automagic discovery and mounting of network shares from all accessible servers without any further configuration, you'll need to add the following to the {{ic|/etc/autofs/auto.master}} file:<br />
<br />
/net -hosts --timeout=60<br />
<br />
Each host name needs to be resolveable, e.g. the name an IP address in {{ic|/etc/hosts}} or via [[Wikipedia:Domain_Name_System|DNS]] and please make sure you have at least {{Pkg|nfs-common}} installed and working.<br />
<br />
For instance, if you have a remote server ''fileserver'' with an NFS share named ''/home/share'', you can just access the share by typing:<br />
<br />
# cd /net/fileserver/home/share<br />
<br />
{{Note|Please note that ''ghosting'', i.e. automatically creating directory placeholders before mounting shares is enabled by default, although AutoFS installation notes claim to remove that option from {{ic|/etc/conf.d/autofs}} in order to start the AutoFS daemon.}}<br />
<br />
The {{ic|-hosts}} option uses a similar mechanism as the {{ic|showmount}} command to detect remote shares. You can see the exported shares by typing:<br />
<br />
# showmount <servername> -e <br />
<br />
Replacing ''<servername>'' with the name of your own server.<br />
<br />
=== Samba ===<br />
<br />
The Arch package does not provide any [[Samba]] or CIFS templates/scripts (23.07.2009), but the following should work for single shares:<br />
<br />
add the following to {{ic|/etc/autofs/auto.master}}<br />
/media/[my_server] /etc/autofs/auto.[my_server]<br />
and then create a file {{ic|/etc/autofs/auto.[my_server]}}<br />
[any_name] -fstype=cifs,[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
You can specify a user name and password to use with the share in the other_options section<br />
[any_name] -fstype=cifs,username=[username],password=[password],[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
{{Note|Escape &#36;, and other characters, with a backslash when neccessary.}}<br />
<br />
=== FTP and SSH (with Fuse) ===<br />
<br />
Remote FTP and [[SSH]] servers can be accessed seamlessly with AutoFS using [[Wikipedia:FUSE|FUSE]], a virtual file system layer. <br />
<br />
==== Remote FTP ====<br />
First, install the {{Pkg|curlftpfs}} package from the Community repository:<br />
<br />
# pacman -S curlftpfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot.<br />
<br />
Next, add a new entry for FTP servers in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/media/ftp /etc/autofs/auto.ftp --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ftp}} and add a server using the {{ic|ftp://myuser:mypassword@host:port/path}} format:<br />
<br />
servername -fstype=curl,rw,allow_other,nodev,nonempty,noatime :ftp\://myuser\:mypassword\@remoteserver<br />
<br />
{{Note| Your passwords are plainly visible for anyone that can run {{ic|df}} (only for mounted servers) or view the file {{ic|/etc/autofs/auto.ftp}}.}}<br />
If you want slightly more security you can create the file {{ic|~root/.netrc}} and add the passwords there. <br />
Passwords are still plain text, but you can have mode 600, and {{ic|df}} command will not show them (mounted or not).<br />
This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:<br />
<br />
machine remoteserver <br />
login myuser<br />
password mypassword<br />
<br />
The line in {{ic|/etc/autofs/auto.ftp}} looks like this without user and password:<br />
<br />
servername -fstype=curl,allow_other :ftp\://remoteserver<br />
<br />
Create the file {{ic|/sbin/mount.curl}} with this code:<br />
<br />
{{hc|/sbin/mount.curl|<nowiki><br />
#! /bin/sh<br />
curlftpfs $1 $2 -o $4,disable_eprt<br />
</nowiki>}}<br />
<br />
Create the file {{ic|/sbin/umount.curl}} with this code:<br />
<br />
{{hc|/sbin/umount.curl|<nowiki><br />
#! /bin/sh<br />
fusermount -u $1<br />
</nowiki>}}<br />
<br />
Set the permissions for both files:<br />
<br />
# chmod 755 /sbin/mount.curl<br />
# chmod 755 /sbin/umount.curl<br />
<br />
After a restart your new FTP server should be accessible through {{ic|/media/ftp/servername}}.<br />
<br />
==== Remote SSH ====<br />
These are basic instructions to access a remote filesystem over [[SSH]] with AutoFS. <br />
<br />
{{Note|The example below does not use an ssh-passphrase to simplify the installation procedure, please note that this may be a security risk in case your local system gets compromised.}}<br />
<br />
Install the {{Pkg|sshfs}} package from the Extra repository:<br />
<br />
# pacman -S sshfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot:<br />
<br />
Install OpenSSH:<br />
# pacman -S openssh<br />
<br />
Generate an [[Using SSH Keys|SSH keypair]]:<br />
# ssh-keygen -t dsa<br />
<br />
When the generator ask for a passphrase, just press {{Keypress|ENTER}}. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article. <br />
<br />
Next, copy the public key to the remote SSH server:<br />
# ssh-copy-id -i /home/username/.ssh/id_dsa.pub username@remotehost<br />
<br />
See that you can login to the remote server without entering a password:<br />
# sudo ssh -i /home/username/.ssh/id_dsa username@remotehost<br />
<br />
{{Note|The above command is needed to add the remote server to the root's list of {{ic|known_hosts}}. Alternatively, hosts can be added to {{ic|/etc/ssh/ssh_known_hosts}}.}}<br />
<br />
Create a new entry for SSH servers in {{ic|/etc/autofs/auto.master}}:<br />
/media/ssh /etc/autofs/auto.ssh --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ssh}} and add an SSH server:<br />
{{hc|/etch/autofs/auto.ssh|2=<br />
servername -fstype=fuse,rw,allow_other,IdentityFile=/home/username/.ssh/id_dsa :sshfs\#username@host\:/<br />
}}<br />
<br />
After a restart your SSH server should be accessible through {{ic|/media/ssh/servername}}.<br />
<br />
== Troubleshooting and tweaks ==<br />
This section contains a few solutions for common issues with AutoFS.<br />
<br />
=== Using NIS ===<br />
<br />
Version 5.0.5 of AutoFS has more advanced support for [[NIS]]. To use AutoFS together with NIS, add {{ic|yp:}} in front of the template names in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/home yp:auto_home --timeout=60 <br />
/sbtn yp:auto_sbtn --timeout=60<br />
+auto.master<br />
<br />
On earlier versions of NIS (before 5.0.4), you should add {{ic|nis}} to {{ic|/etc/nsswitch.conf}}:<br />
automount: files nis<br />
<br />
=== Optional parameters ===<br />
You can set parameters like {{ic|timeout}} systemwide for all AutoFS media in {{ic|/etc/conf.d/autofs}}:<br />
<br />
* Open the {{ic|/etc/conf.d/autofs}} file and edit the {{ic|daemonoptions}} line:<br />
daemonoptions='--timeout=5'<br />
<br />
* To enable logging (default is no logging at all), add {{ic|--verbose}} to the {{ic|daemonoptions}} line in {{ic|/etc/conf.d/autofs}} e.g.:<br />
daemonoptions='--verbose --timeout=5'<br />
<br />
After restarting the {{ic|autofs}} daemon, verbose output is visible in {{ic|/var/log/daemon.log}}.<br />
<br />
=== Identify multiple devices ===<br />
If you use multiple USB drives/sticks and want to easily tell them apart, you can use AutoFS to set up the mount points and [[Udev]] to create distinct names for your USB drives. See [[Map Custom Device Entries with udev]] for instructions on setting up Udev rules.<br />
<br />
=== AutoFS permissions ===<br />
If AutoFS isn't working for you, make sure that the permissions of the templates files are correct, otherwise AutoFS will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:<br />
<br />
*0644 - /etc/autofs/auto.master<br />
*0644 - /etc/autofs/auto.media<br />
*0644 - /etc/autofs/auto.misc<br />
*0644 - /etc/conf.d/autofs<br />
<br />
In general, scripts (like previous {{ic|auto.net}}) should have executable ({{ic|chown a+x filename}}) bits set and lists of mounts shouldn't.<br />
<br />
If you are getting errors in {{ic|/var/log/daemon.log}} similar to this, you have a permissions problem:<br />
<br />
May 7 19:44:16 peterix automount[15218]: lookup(program): lookup for petr failed<br />
May 7 19:44:16 peterix automount[15218]: failed to mount /media/cifs/petr<br />
<br />
== External links and resources ==<br />
* FTP and SFTP usage with AutoFS is based on this Gentoo Wiki article: http://en.gentoo-wiki.com/wiki/Mounting_SFTP_and_FTP_shares<br />
* More information on SSH can be found on the [[SSH]] and [[Using_SSH_Keys|Using SSH Keys]] pages of this wiki.<br />
* Information on setting up NFS can be found here: [[NFS]]<br />
<br />
== Alternatives to AutoFS ==<br />
*[[Thunar#Thunar_Volume_Manager|Thunar Volume Manager]] is an automount system for users of the [[Thunar]] file manager.<br />
* Pcmanfm-fuse is a lightweight file manager with built-in support for accessing remote shares: https://aur.archlinux.org/packages.php?ID=22992<br />
* [[udiskie]] is a minimalistic automatic disk mounting service using udisks</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Autofs&diff=198872
Autofs
2012-04-24T23:10:58Z
<p>Teratomata: Added direct mount options</p>
<hr />
<div>[[Category:File systems]]<br />
{{i18n|Autofs}}<br />
{{Article summary start}}<br />
{{Article summary text|This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.}}<br />
{{Article summary end}}<br />
<br />
== Introduction ==<br />
This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.<br />
<br />
== Installation ==<br />
*Install the {{Pkg|autofs}} package:<br />
# pacman -S autofs<br />
<br />
*Load the {{ic|autofs4}} module as root:<br />
# modprobe autofs4<br />
<br />
== Configuration ==<br />
AutoFS uses template files for configuration which are located in {{ic|/etc/autofs}} The main template is called {{ic|auto.master}}, which can point to one or more other templates for specific media types.<br />
<br />
* Open the file {{ic|/etc/autofs/auto.master}} with your favorite editor, you will see something similar to this:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/var/autofs/misc /etc/autofs/auto.misc<br />
/var/autofs/net /etc/autofs/auto.net<br />
<br />
}}<br />
<br />
The first value on each line determines the base directory under which all the media in a template are mounted, the second value is which template to use. The default base path is {{ic|/var/autofs}}, but you can change this to any other location you prefer. For instance:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/media/misc /etc/autofs/auto.misc --timeout=5 --ghost<br />
/media/net /etc/autofs/auto.net --timeout=60 --ghost<br />
<br />
}}<br />
{{Note|Make sure there is an empty line on the end of template files (press {{Keypress|ENTER}} after last word). If there is no correct EOF line, the AutoFS daemon won't properly load.}}<br />
<br />
The optional parameter {{ic|timeout}} sets the amount of seconds after which to unmount directories. The parameter {{ic|ghost}} determines that configured mounts will always be shown, instead of only when they are inserted and accessed. This can be useful since you won't have to remember or guess the names of removable media and network shares.<br />
<br />
The base directory will be created if it does not exist on your system. The base directory will be mounted on to load the dynamically loaded media, which means any content in the base directory will not be accessible while autofs is on. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in {{ic|auto.master}} and restart AutoFS to regain the original contents.<br />
<br />
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links.<br />
<br />
# ln -s /var/autofs/net/share_name /media/share_name<br />
<br />
Alternatively, you can have autofs mount your media to a specific folder, rather than inside a common folder.<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/- /etc/autofs/auto.misc<br />
}}<br />
{{hc|/etc/autofs/auto.template|2=<br />
/path/to/folder -options :/device/path<br />
/home/user/usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
}}<br />
<br />
* Open the file {{ic|/etc/nsswitch.conf}} and add an entry for automount:<br />
automount: files<br />
<br />
* When you are done configuring your templates (see below), launch the AutoFS daemon as root:<br />
# rc.d start autofs<br />
<br />
To start the daemon on boot you can add {{ic|autofs}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, and {{ic|autofs4}} to the modules array in the same file.<br />
<br />
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.<br />
<br />
=== Removable media ===<br />
* Open {{ic|/etc/autofs/auto.misc}} to add, remove or edit miscellaneous devices. For instance:<br />
<br />
{{hc|/etc/autofs/auto.misc|<nowiki><br />
#kernel -ro ftp.kernel.org:/pub/linux<br />
#boot -fstype=ext2 :/dev/hda1<br />
usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
cdrom -fstype=iso9660,ro :/dev/cdrom<br />
#floppy -fstype=auto :/dev/fd0<br />
</nowiki>}}<br />
<br />
If you have a CD/DVD combo-drive you can change the {{ic|cdrom}} line with {{ic|-fstype<nowiki>=</nowiki>auto}} to have the media type autodetected.<br />
<br />
=== NFS Network mounts ===<br />
<br />
AutoFS provides a new way of automatically discovering and mounting [[NFS]]-shares on remote servers (the AutoFS network template in {{ic|/etc/autofs/auto.net}} has been removed in autofs5). To enable automagic discovery and mounting of network shares from all accessible servers without any further configuration, you'll need to add the following to the {{ic|/etc/autofs/auto.master}} file:<br />
<br />
/net -hosts --timeout=60<br />
<br />
Each host name needs to be resolveable, e.g. the name an IP address in {{ic|/etc/hosts}} or via [[Wikipedia:Domain_Name_System|DNS]] and please make sure you have at least {{Pkg|nfs-common}} installed and working.<br />
<br />
For instance, if you have a remote server ''fileserver'' with an NFS share named ''/home/share'', you can just access the share by typing:<br />
<br />
# cd /net/fileserver/home/share<br />
<br />
{{Note|Please note that ''ghosting'', i.e. automatically creating directory placeholders before mounting shares is enabled by default, although AutoFS installation notes claim to remove that option from {{ic|/etc/conf.d/autofs}} in order to start the AutoFS daemon.}}<br />
<br />
The {{ic|-hosts}} option uses a similar mechanism as the {{ic|showmount}} command to detect remote shares. You can see the exported shares by typing:<br />
<br />
# showmount <servername> -e <br />
<br />
Replacing ''<servername>'' with the name of your own server.<br />
<br />
=== Samba ===<br />
<br />
The Arch package does not provide any [[Samba]] or CIFS templates/scripts (23.07.2009), but the following should work for single shares:<br />
<br />
add the following to {{ic|/etc/autofs/auto.master}}<br />
/media/[my_server] /etc/autofs/auto.[my_server]<br />
and then create a file {{ic|/etc/autofs/auto.[my_server]}}<br />
[any_name] -fstype=cifs,[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
You can specify a user name and password to use with the share in the other_options section<br />
[any_name] -fstype=cifs,username=[username],password=[password],[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
{{Note|Escape &#36;, and other characters, with a backslash when neccessary.}}<br />
<br />
=== FTP and SSH (with Fuse) ===<br />
<br />
Remote FTP and [[SSH]] servers can be accessed seamlessly with AutoFS using [[Wikipedia:FUSE|FUSE]], a virtual file system layer. <br />
<br />
==== Remote FTP ====<br />
First, install the {{Pkg|curlftpfs}} package from the Community repository:<br />
<br />
# pacman -S curlftpfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot.<br />
<br />
Next, add a new entry for FTP servers in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/media/ftp /etc/autofs/auto.ftp --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ftp}} and add a server using the {{ic|ftp://myuser:mypassword@host:port/path}} format:<br />
<br />
servername -fstype=curl,rw,allow_other,nodev,nonempty,noatime :ftp\://myuser\:mypassword\@remoteserver<br />
<br />
{{Note| Your passwords are plainly visible for anyone that can run {{ic|df}} (only for mounted servers) or view the file {{ic|/etc/autofs/auto.ftp}}.}}<br />
If you want slightly more security you can create the file {{ic|~root/.netrc}} and add the passwords there. <br />
Passwords are still plain text, but you can have mode 600, and {{ic|df}} command will not show them (mounted or not).<br />
This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:<br />
<br />
machine remoteserver <br />
login myuser<br />
password mypassword<br />
<br />
The line in {{ic|/etc/autofs/auto.ftp}} looks like this without user and password:<br />
<br />
servername -fstype=curl,allow_other :ftp\://remoteserver<br />
<br />
Create the file {{ic|/sbin/mount.curl}} with this code:<br />
<br />
{{hc|/sbin/mount.curl|<nowiki><br />
#! /bin/sh<br />
curlftpfs $1 $2 -o $4,disable_eprt<br />
</nowiki>}}<br />
<br />
Create the file {{ic|/sbin/umount.curl}} with this code:<br />
<br />
{{hc|/sbin/umount.curl|<nowiki><br />
#! /bin/sh<br />
fusermount -u $1<br />
</nowiki>}}<br />
<br />
Set the permissions for both files:<br />
<br />
# chmod 755 /sbin/mount.curl<br />
# chmod 755 /sbin/umount.curl<br />
<br />
After a restart your new FTP server should be accessible through {{ic|/media/ftp/servername}}.<br />
<br />
==== Remote SSH ====<br />
These are basic instructions to access a remote filesystem over [[SSH]] with AutoFS. <br />
<br />
{{Note|The example below does not use an ssh-passphrase to simplify the installation procedure, please note that this may be a security risk in case your local system gets compromised.}}<br />
<br />
Install the {{Pkg|sshfs}} package from the Extra repository:<br />
<br />
# pacman -S sshfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot:<br />
<br />
Install OpenSSH:<br />
# pacman -S openssh<br />
<br />
Generate an [[Using SSH Keys|SSH keypair]]:<br />
# ssh-keygen -t dsa<br />
<br />
When the generator ask for a passphrase, just press {{Keypress|ENTER}}. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article. <br />
<br />
Next, copy the public key to the remote SSH server:<br />
# ssh-copy-id -i /home/username/.ssh/id_dsa.pub username@remotehost<br />
<br />
See that you can login to the remote server without entering a password:<br />
# sudo ssh -i /home/username/.ssh/id_dsa username@remotehost<br />
<br />
{{Note|The above command is needed to add the remote server to the root's list of {{ic|known_hosts}}. Alternatively, hosts can be added to {{ic|/etc/ssh/ssh_known_hosts}}.}}<br />
<br />
Create a new entry for SSH servers in {{ic|/etc/autofs/auto.master}}:<br />
/media/ssh /etc/autofs/auto.ssh --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ssh}} and add an SSH server:<br />
{{hc|/etch/autofs/auto.ssh|2=<br />
servername -fstype=fuse,rw,allow_other,IdentityFile=/home/username/.ssh/id_dsa :sshfs\#username@host\:/<br />
}}<br />
<br />
After a restart your SSH server should be accessible through {{ic|/media/ssh/servername}}.<br />
<br />
== Troubleshooting and tweaks ==<br />
This section contains a few solutions for common issues with AutoFS.<br />
<br />
=== Using NIS ===<br />
<br />
Version 5.0.5 of AutoFS has more advanced support for [[NIS]]. To use AutoFS together with NIS, add {{ic|yp:}} in front of the template names in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/home yp:auto_home --timeout=60 <br />
/sbtn yp:auto_sbtn --timeout=60<br />
+auto.master<br />
<br />
On earlier versions of NIS (before 5.0.4), you should add {{ic|nis}} to {{ic|/etc/nsswitch.conf}}:<br />
automount: files nis<br />
<br />
=== Optional parameters ===<br />
You can set parameters like {{ic|timeout}} systemwide for all AutoFS media in {{ic|/etc/conf.d/autofs}}:<br />
<br />
* Open the {{ic|/etc/conf.d/autofs}} file and edit the {{ic|daemonoptions}} line:<br />
daemonoptions='--timeout=5'<br />
<br />
* To enable logging (default is no logging at all), add {{ic|--verbose}} to the {{ic|daemonoptions}} line in {{ic|/etc/conf.d/autofs}} e.g.:<br />
daemonoptions='--verbose --timeout=5'<br />
<br />
After restarting the {{ic|autofs}} daemon, verbose output is visible in {{ic|/var/log/daemon.log}}.<br />
<br />
=== Identify multiple devices ===<br />
If you use multiple USB drives/sticks and want to easily tell them apart, you can use AutoFS to set up the mount points and [[Udev]] to create distinct names for your USB drives. See [[Map Custom Device Entries with udev]] for instructions on setting up Udev rules.<br />
<br />
=== AutoFS permissions ===<br />
If AutoFS isn't working for you, make sure that the permissions of the templates files are correct, otherwise AutoFS will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:<br />
<br />
*0644 - /etc/autofs/auto.master<br />
*0644 - /etc/autofs/auto.media<br />
*0644 - /etc/autofs/auto.misc<br />
*0644 - /etc/conf.d/autofs<br />
<br />
In general, scripts (like previous {{ic|auto.net}}) should have executable ({{ic|chown a+x filename}}) bits set and lists of mounts shouldn't.<br />
<br />
If you are getting errors in {{ic|/var/log/daemon.log}} similar to this, you have a permissions problem:<br />
<br />
May 7 19:44:16 peterix automount[15218]: lookup(program): lookup for petr failed<br />
May 7 19:44:16 peterix automount[15218]: failed to mount /media/cifs/petr<br />
<br />
== External links and resources ==<br />
* FTP and SFTP usage with AutoFS is based on this Gentoo Wiki article: http://en.gentoo-wiki.com/wiki/Mounting_SFTP_and_FTP_shares<br />
* More information on SSH can be found on the [[SSH]] and [[Using_SSH_Keys|Using SSH Keys]] pages of this wiki.<br />
* Information on setting up NFS can be found here: [[NFS]]<br />
<br />
== Alternatives to AutoFS ==<br />
*[[Thunar#Thunar_Volume_Manager|Thunar Volume Manager]] is an automount system for users of the [[Thunar]] file manager.<br />
* Pcmanfm-fuse is a lightweight file manager with built-in support for accessing remote shares: https://aur.archlinux.org/packages.php?ID=22992<br />
* [[udiskie]] is a minimalistic automatic disk mounting service using udisks</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Autofs&diff=198871
Autofs
2012-04-24T23:02:03Z
<p>Teratomata: clarified some mounting actions</p>
<hr />
<div>[[Category:File systems]]<br />
{{i18n|Autofs}}<br />
{{Article summary start}}<br />
{{Article summary text|This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.}}<br />
{{Article summary end}}<br />
<br />
== Introduction ==<br />
This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.<br />
<br />
== Installation ==<br />
*Install the {{Pkg|autofs}} package:<br />
# pacman -S autofs<br />
<br />
*Load the {{ic|autofs4}} module as root:<br />
# modprobe autofs4<br />
<br />
== Configuration ==<br />
AutoFS uses template files for configuration which are located in {{ic|/etc/autofs}} The main template is called {{ic|auto.master}}, which can point to one or more other templates for specific media types.<br />
<br />
* Open the file {{ic|/etc/autofs/auto.master}} with your favorite editor, you will see something similar to this:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/var/autofs/misc /etc/autofs/auto.misc<br />
/var/autofs/net /etc/autofs/auto.net<br />
<br />
}}<br />
<br />
The first value on each line determines the base directory under which all the media in a template are mounted, the second value is which template to use. The default base path is {{ic|/var/autofs}}, but you can change this to any other location you prefer. For instance:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/media/misc /etc/autofs/auto.misc --timeout=5 --ghost<br />
/media/net /etc/autofs/auto.net --timeout=60 --ghost<br />
<br />
}}<br />
<br />
The optional parameter {{ic|timeout}} sets the amount of seconds after which to unmount directories. The parameter {{ic|ghost}} determines that configured mounts will always be shown, instead of only when they are inserted and accessed. This can be useful since you won't have to remember or guess the names of removable media and network shares.<br />
<br />
The base directory will be created if it does not exist on your system. The base directory will be mounted on to load the dynamically loaded media, which means any content in the base directory will not be accessible while autofs is on. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in {{ic|auto.master}} and restart AutoFS to regain the original contents.<br />
<br />
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links.<br />
<br />
# ln -s /var/autofs/net/share_name /media/share_name<br />
<br />
{{Note|Make sure there is an empty line on the end of template files (press {{Keypress|ENTER}} after last word). If there is no correct EOF line, the AutoFS daemon won't properly load.}}<br />
<br />
* Open the file {{ic|/etc/nsswitch.conf}} and add an entry for automount:<br />
automount: files<br />
<br />
* When you are done configuring your templates (see below), launch the AutoFS daemon as root:<br />
# rc.d start autofs<br />
<br />
To start the daemon on boot you can add {{ic|autofs}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, and {{ic|autofs4}} to the modules array in the same file.<br />
<br />
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.<br />
<br />
=== Removable media ===<br />
* Open {{ic|/etc/autofs/auto.misc}} to add, remove or edit miscellaneous devices. For instance:<br />
<br />
{{hc|/etc/autofs/auto.misc|<nowiki><br />
#kernel -ro ftp.kernel.org:/pub/linux<br />
#boot -fstype=ext2 :/dev/hda1<br />
usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
cdrom -fstype=iso9660,ro :/dev/cdrom<br />
#floppy -fstype=auto :/dev/fd0<br />
</nowiki>}}<br />
<br />
If you have a CD/DVD combo-drive you can change the {{ic|cdrom}} line with {{ic|-fstype<nowiki>=</nowiki>auto}} to have the media type autodetected.<br />
<br />
=== NFS Network mounts ===<br />
<br />
AutoFS provides a new way of automatically discovering and mounting [[NFS]]-shares on remote servers (the AutoFS network template in {{ic|/etc/autofs/auto.net}} has been removed in autofs5). To enable automagic discovery and mounting of network shares from all accessible servers without any further configuration, you'll need to add the following to the {{ic|/etc/autofs/auto.master}} file:<br />
<br />
/net -hosts --timeout=60<br />
<br />
Each host name needs to be resolveable, e.g. the name an IP address in {{ic|/etc/hosts}} or via [[Wikipedia:Domain_Name_System|DNS]] and please make sure you have at least {{Pkg|nfs-common}} installed and working.<br />
<br />
For instance, if you have a remote server ''fileserver'' with an NFS share named ''/home/share'', you can just access the share by typing:<br />
<br />
# cd /net/fileserver/home/share<br />
<br />
{{Note|Please note that ''ghosting'', i.e. automatically creating directory placeholders before mounting shares is enabled by default, although AutoFS installation notes claim to remove that option from {{ic|/etc/conf.d/autofs}} in order to start the AutoFS daemon.}}<br />
<br />
The {{ic|-hosts}} option uses a similar mechanism as the {{ic|showmount}} command to detect remote shares. You can see the exported shares by typing:<br />
<br />
# showmount <servername> -e <br />
<br />
Replacing ''<servername>'' with the name of your own server.<br />
<br />
=== Samba ===<br />
<br />
The Arch package does not provide any [[Samba]] or CIFS templates/scripts (23.07.2009), but the following should work for single shares:<br />
<br />
add the following to {{ic|/etc/autofs/auto.master}}<br />
/media/[my_server] /etc/autofs/auto.[my_server]<br />
and then create a file {{ic|/etc/autofs/auto.[my_server]}}<br />
[any_name] -fstype=cifs,[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
You can specify a user name and password to use with the share in the other_options section<br />
[any_name] -fstype=cifs,username=[username],password=[password],[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
{{Note|Escape &#36;, and other characters, with a backslash when neccessary.}}<br />
<br />
=== FTP and SSH (with Fuse) ===<br />
<br />
Remote FTP and [[SSH]] servers can be accessed seamlessly with AutoFS using [[Wikipedia:FUSE|FUSE]], a virtual file system layer. <br />
<br />
==== Remote FTP ====<br />
First, install the {{Pkg|curlftpfs}} package from the Community repository:<br />
<br />
# pacman -S curlftpfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot.<br />
<br />
Next, add a new entry for FTP servers in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/media/ftp /etc/autofs/auto.ftp --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ftp}} and add a server using the {{ic|ftp://myuser:mypassword@host:port/path}} format:<br />
<br />
servername -fstype=curl,rw,allow_other,nodev,nonempty,noatime :ftp\://myuser\:mypassword\@remoteserver<br />
<br />
{{Note| Your passwords are plainly visible for anyone that can run {{ic|df}} (only for mounted servers) or view the file {{ic|/etc/autofs/auto.ftp}}.}}<br />
If you want slightly more security you can create the file {{ic|~root/.netrc}} and add the passwords there. <br />
Passwords are still plain text, but you can have mode 600, and {{ic|df}} command will not show them (mounted or not).<br />
This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:<br />
<br />
machine remoteserver <br />
login myuser<br />
password mypassword<br />
<br />
The line in {{ic|/etc/autofs/auto.ftp}} looks like this without user and password:<br />
<br />
servername -fstype=curl,allow_other :ftp\://remoteserver<br />
<br />
Create the file {{ic|/sbin/mount.curl}} with this code:<br />
<br />
{{hc|/sbin/mount.curl|<nowiki><br />
#! /bin/sh<br />
curlftpfs $1 $2 -o $4,disable_eprt<br />
</nowiki>}}<br />
<br />
Create the file {{ic|/sbin/umount.curl}} with this code:<br />
<br />
{{hc|/sbin/umount.curl|<nowiki><br />
#! /bin/sh<br />
fusermount -u $1<br />
</nowiki>}}<br />
<br />
Set the permissions for both files:<br />
<br />
# chmod 755 /sbin/mount.curl<br />
# chmod 755 /sbin/umount.curl<br />
<br />
After a restart your new FTP server should be accessible through {{ic|/media/ftp/servername}}.<br />
<br />
==== Remote SSH ====<br />
These are basic instructions to access a remote filesystem over [[SSH]] with AutoFS. <br />
<br />
{{Note|The example below does not use an ssh-passphrase to simplify the installation procedure, please note that this may be a security risk in case your local system gets compromised.}}<br />
<br />
Install the {{Pkg|sshfs}} package from the Extra repository:<br />
<br />
# pacman -S sshfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot:<br />
<br />
Install OpenSSH:<br />
# pacman -S openssh<br />
<br />
Generate an [[Using SSH Keys|SSH keypair]]:<br />
# ssh-keygen -t dsa<br />
<br />
When the generator ask for a passphrase, just press {{Keypress|ENTER}}. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article. <br />
<br />
Next, copy the public key to the remote SSH server:<br />
# ssh-copy-id -i /home/username/.ssh/id_dsa.pub username@remotehost<br />
<br />
See that you can login to the remote server without entering a password:<br />
# sudo ssh -i /home/username/.ssh/id_dsa username@remotehost<br />
<br />
{{Note|The above command is needed to add the remote server to the root's list of {{ic|known_hosts}}. Alternatively, hosts can be added to {{ic|/etc/ssh/ssh_known_hosts}}.}}<br />
<br />
Create a new entry for SSH servers in {{ic|/etc/autofs/auto.master}}:<br />
/media/ssh /etc/autofs/auto.ssh --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ssh}} and add an SSH server:<br />
{{hc|/etch/autofs/auto.ssh|2=<br />
servername -fstype=fuse,rw,allow_other,IdentityFile=/home/username/.ssh/id_dsa :sshfs\#username@host\:/<br />
}}<br />
<br />
After a restart your SSH server should be accessible through {{ic|/media/ssh/servername}}.<br />
<br />
== Troubleshooting and tweaks ==<br />
This section contains a few solutions for common issues with AutoFS.<br />
<br />
=== Using NIS ===<br />
<br />
Version 5.0.5 of AutoFS has more advanced support for [[NIS]]. To use AutoFS together with NIS, add {{ic|yp:}} in front of the template names in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/home yp:auto_home --timeout=60 <br />
/sbtn yp:auto_sbtn --timeout=60<br />
+auto.master<br />
<br />
On earlier versions of NIS (before 5.0.4), you should add {{ic|nis}} to {{ic|/etc/nsswitch.conf}}:<br />
automount: files nis<br />
<br />
=== Optional parameters ===<br />
You can set parameters like {{ic|timeout}} systemwide for all AutoFS media in {{ic|/etc/conf.d/autofs}}:<br />
<br />
* Open the {{ic|/etc/conf.d/autofs}} file and edit the {{ic|daemonoptions}} line:<br />
daemonoptions='--timeout=5'<br />
<br />
* To enable logging (default is no logging at all), add {{ic|--verbose}} to the {{ic|daemonoptions}} line in {{ic|/etc/conf.d/autofs}} e.g.:<br />
daemonoptions='--verbose --timeout=5'<br />
<br />
After restarting the {{ic|autofs}} daemon, verbose output is visible in {{ic|/var/log/daemon.log}}.<br />
<br />
=== Identify multiple devices ===<br />
If you use multiple USB drives/sticks and want to easily tell them apart, you can use AutoFS to set up the mount points and [[Udev]] to create distinct names for your USB drives. See [[Map Custom Device Entries with udev]] for instructions on setting up Udev rules.<br />
<br />
=== AutoFS permissions ===<br />
If AutoFS isn't working for you, make sure that the permissions of the templates files are correct, otherwise AutoFS will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:<br />
<br />
*0644 - /etc/autofs/auto.master<br />
*0644 - /etc/autofs/auto.media<br />
*0644 - /etc/autofs/auto.misc<br />
*0644 - /etc/conf.d/autofs<br />
<br />
In general, scripts (like previous {{ic|auto.net}}) should have executable ({{ic|chown a+x filename}}) bits set and lists of mounts shouldn't.<br />
<br />
If you are getting errors in {{ic|/var/log/daemon.log}} similar to this, you have a permissions problem:<br />
<br />
May 7 19:44:16 peterix automount[15218]: lookup(program): lookup for petr failed<br />
May 7 19:44:16 peterix automount[15218]: failed to mount /media/cifs/petr<br />
<br />
== External links and resources ==<br />
* FTP and SFTP usage with AutoFS is based on this Gentoo Wiki article: http://en.gentoo-wiki.com/wiki/Mounting_SFTP_and_FTP_shares<br />
* More information on SSH can be found on the [[SSH]] and [[Using_SSH_Keys|Using SSH Keys]] pages of this wiki.<br />
* Information on setting up NFS can be found here: [[NFS]]<br />
<br />
== Alternatives to AutoFS ==<br />
*[[Thunar#Thunar_Volume_Manager|Thunar Volume Manager]] is an automount system for users of the [[Thunar]] file manager.<br />
* Pcmanfm-fuse is a lightweight file manager with built-in support for accessing remote shares: https://aur.archlinux.org/packages.php?ID=22992<br />
* [[udiskie]] is a minimalistic automatic disk mounting service using udisks</div>
Teratomata
https://wiki.archlinux.org/index.php?title=Autofs&diff=198868
Autofs
2012-04-24T22:44:58Z
<p>Teratomata: /* Configuration */</p>
<hr />
<div>[[Category:File systems]]<br />
{{i18n|Autofs}}<br />
{{Article summary start}}<br />
{{Article summary text|This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.}}<br />
{{Article summary end}}<br />
<br />
== Introduction ==<br />
This document outlines the procedure needed to set up AutoFS, a package that provides support for automounting removable media or network shares when they are inserted or accessed.<br />
<br />
== Installation ==<br />
*Install the {{Pkg|autofs}} package:<br />
# pacman -S autofs<br />
<br />
*Load the {{ic|autofs4}} module as root:<br />
# modprobe autofs4<br />
<br />
== Configuration ==<br />
AutoFS uses template files for configuration which are located in {{ic|/etc/autofs}} The main template is called {{ic|auto.master}}, which can point to one or more other templates for specific media types.<br />
<br />
* Open the file {{ic|/etc/autofs/auto.master}} with your favorite editor, you will see something similar to this:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/var/autofs/misc /etc/autofs/auto.misc<br />
/var/autofs/net /etc/autofs/auto.net<br />
<br />
}}<br />
<br />
The first value on each line determines the base directory under which media are mounted, the second value which template to use. The default base path is {{ic|/var/autofs}}, but you can change this to any other location you prefer. For instance:<br />
<br />
{{hc|/etc/autofs/auto.master|2=<br />
/media/misc /etc/autofs/auto.misc --timeout=5 --ghost<br />
/media/net /etc/autofs/auto.net --timeout=60 --ghost<br />
<br />
}}<br />
<br />
The optional parameter {{ic|timeout}} sets the amount of seconds after which to unmount directories. The parameter {{ic|ghost}} determines that configured mounts will always be shown, instead of only when they are inserted and accessed. This can be useful since you won't have to remember or guess the names of removable media and network shares.<br />
<br />
The target directories have to exist on your system and need to be empty, since their contents will be swapped with the dynamically loaded media. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in {{ic|auto.master}} and restart AutoFS to regain the original contents.<br />
<br />
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links<br />
<br />
# ln -s /var/autofs/net/share_name /media/share_name<br />
<br />
{{Note|Make sure there is an empty line on the end of template files (press {{Keypress|ENTER}} after last word). If there is no correct EOF line, the AutoFS daemon won't properly load.}}<br />
<br />
* Open the file {{ic|/etc/nsswitch.conf}} and add an entry for automount:<br />
automount: files<br />
<br />
* When you are done configuring your templates (see below), launch the AutoFS daemon as root:<br />
# rc.d start autofs<br />
<br />
To start the daemon on boot you can add {{ic|autofs}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, and {{ic|autofs4}} to the modules array in the same file.<br />
<br />
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.<br />
<br />
=== Removable media ===<br />
* Open {{ic|/etc/autofs/auto.misc}} to add, remove or edit miscellaneous devices. For instance:<br />
<br />
{{hc|/etc/autofs/auto.misc|<nowiki><br />
#kernel -ro ftp.kernel.org:/pub/linux<br />
#boot -fstype=ext2 :/dev/hda1<br />
usbstick -fstype=auto,async,nodev,nosuid,umask=000 :/dev/sdb1<br />
cdrom -fstype=iso9660,ro :/dev/cdrom<br />
#floppy -fstype=auto :/dev/fd0<br />
</nowiki>}}<br />
<br />
If you have a CD/DVD combo-drive you can change the {{ic|cdrom}} line with {{ic|-fstype<nowiki>=</nowiki>auto}} to have the media type autodetected.<br />
<br />
=== NFS Network mounts ===<br />
<br />
AutoFS provides a new way of automatically discovering and mounting [[NFS]]-shares on remote servers (the AutoFS network template in {{ic|/etc/autofs/auto.net}} has been removed in autofs5). To enable automagic discovery and mounting of network shares from all accessible servers without any further configuration, you'll need to add the following to the {{ic|/etc/autofs/auto.master}} file:<br />
<br />
/net -hosts --timeout=60<br />
<br />
Each host name needs to be resolveable, e.g. the name an IP address in {{ic|/etc/hosts}} or via [[Wikipedia:Domain_Name_System|DNS]] and please make sure you have at least {{Pkg|nfs-common}} installed and working.<br />
<br />
For instance, if you have a remote server ''fileserver'' with an NFS share named ''/home/share'', you can just access the share by typing:<br />
<br />
# cd /net/fileserver/home/share<br />
<br />
{{Note|Please note that ''ghosting'', i.e. automatically creating directory placeholders before mounting shares is enabled by default, although AutoFS installation notes claim to remove that option from {{ic|/etc/conf.d/autofs}} in order to start the AutoFS daemon.}}<br />
<br />
The {{ic|-hosts}} option uses a similar mechanism as the {{ic|showmount}} command to detect remote shares. You can see the exported shares by typing:<br />
<br />
# showmount <servername> -e <br />
<br />
Replacing ''<servername>'' with the name of your own server.<br />
<br />
=== Samba ===<br />
<br />
The Arch package does not provide any [[Samba]] or CIFS templates/scripts (23.07.2009), but the following should work for single shares:<br />
<br />
add the following to {{ic|/etc/autofs/auto.master}}<br />
/media/[my_server] /etc/autofs/auto.[my_server]<br />
and then create a file {{ic|/etc/autofs/auto.[my_server]}}<br />
[any_name] -fstype=cifs,[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
You can specify a user name and password to use with the share in the other_options section<br />
[any_name] -fstype=cifs,username=[username],password=[password],[other_options] ://[remote_server]/[remote_share_name]<br />
<br />
{{Note|Escape &#36;, and other characters, with a backslash when neccessary.}}<br />
<br />
=== FTP and SSH (with Fuse) ===<br />
<br />
Remote FTP and [[SSH]] servers can be accessed seamlessly with AutoFS using [[Wikipedia:FUSE|FUSE]], a virtual file system layer. <br />
<br />
==== Remote FTP ====<br />
First, install the {{Pkg|curlftpfs}} package from the Community repository:<br />
<br />
# pacman -S curlftpfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot.<br />
<br />
Next, add a new entry for FTP servers in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/media/ftp /etc/autofs/auto.ftp --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ftp}} and add a server using the {{ic|ftp://myuser:mypassword@host:port/path}} format:<br />
<br />
servername -fstype=curl,rw,allow_other,nodev,nonempty,noatime :ftp\://myuser\:mypassword\@remoteserver<br />
<br />
{{Note| Your passwords are plainly visible for anyone that can run {{ic|df}} (only for mounted servers) or view the file {{ic|/etc/autofs/auto.ftp}}.}}<br />
If you want slightly more security you can create the file {{ic|~root/.netrc}} and add the passwords there. <br />
Passwords are still plain text, but you can have mode 600, and {{ic|df}} command will not show them (mounted or not).<br />
This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:<br />
<br />
machine remoteserver <br />
login myuser<br />
password mypassword<br />
<br />
The line in {{ic|/etc/autofs/auto.ftp}} looks like this without user and password:<br />
<br />
servername -fstype=curl,allow_other :ftp\://remoteserver<br />
<br />
Create the file {{ic|/sbin/mount.curl}} with this code:<br />
<br />
{{hc|/sbin/mount.curl|<nowiki><br />
#! /bin/sh<br />
curlftpfs $1 $2 -o $4,disable_eprt<br />
</nowiki>}}<br />
<br />
Create the file {{ic|/sbin/umount.curl}} with this code:<br />
<br />
{{hc|/sbin/umount.curl|<nowiki><br />
#! /bin/sh<br />
fusermount -u $1<br />
</nowiki>}}<br />
<br />
Set the permissions for both files:<br />
<br />
# chmod 755 /sbin/mount.curl<br />
# chmod 755 /sbin/umount.curl<br />
<br />
After a restart your new FTP server should be accessible through {{ic|/media/ftp/servername}}.<br />
<br />
==== Remote SSH ====<br />
These are basic instructions to access a remote filesystem over [[SSH]] with AutoFS. <br />
<br />
{{Note|The example below does not use an ssh-passphrase to simplify the installation procedure, please note that this may be a security risk in case your local system gets compromised.}}<br />
<br />
Install the {{Pkg|sshfs}} package from the Extra repository:<br />
<br />
# pacman -S sshfs<br />
<br />
Load the {{ic|fuse}} module:<br />
<br />
# modprobe fuse<br />
<br />
Add fuse to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}} to load it on each system boot:<br />
<br />
Install OpenSSH:<br />
# pacman -S openssh<br />
<br />
Generate an [[Using SSH Keys|SSH keypair]]:<br />
# ssh-keygen -t dsa<br />
<br />
When the generator ask for a passphrase, just press {{Keypress|ENTER}}. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article. <br />
<br />
Next, copy the public key to the remote SSH server:<br />
# ssh-copy-id -i /home/username/.ssh/id_dsa.pub username@remotehost<br />
<br />
See that you can login to the remote server without entering a password:<br />
# sudo ssh -i /home/username/.ssh/id_dsa username@remotehost<br />
<br />
{{Note|The above command is needed to add the remote server to the root's list of {{ic|known_hosts}}. Alternatively, hosts can be added to {{ic|/etc/ssh/ssh_known_hosts}}.}}<br />
<br />
Create a new entry for SSH servers in {{ic|/etc/autofs/auto.master}}:<br />
/media/ssh /etc/autofs/auto.ssh --timeout=60 --ghost<br />
<br />
Create the file {{ic|/etc/autofs/auto.ssh}} and add an SSH server:<br />
{{hc|/etch/autofs/auto.ssh|2=<br />
servername -fstype=fuse,rw,allow_other,IdentityFile=/home/username/.ssh/id_dsa :sshfs\#username@host\:/<br />
}}<br />
<br />
After a restart your SSH server should be accessible through {{ic|/media/ssh/servername}}.<br />
<br />
== Troubleshooting and tweaks ==<br />
This section contains a few solutions for common issues with AutoFS.<br />
<br />
=== Using NIS ===<br />
<br />
Version 5.0.5 of AutoFS has more advanced support for [[NIS]]. To use AutoFS together with NIS, add {{ic|yp:}} in front of the template names in {{ic|/etc/autofs/auto.master}}:<br />
<br />
/home yp:auto_home --timeout=60 <br />
/sbtn yp:auto_sbtn --timeout=60<br />
+auto.master<br />
<br />
On earlier versions of NIS (before 5.0.4), you should add {{ic|nis}} to {{ic|/etc/nsswitch.conf}}:<br />
automount: files nis<br />
<br />
=== Optional parameters ===<br />
You can set parameters like {{ic|timeout}} systemwide for all AutoFS media in {{ic|/etc/conf.d/autofs}}:<br />
<br />
* Open the {{ic|/etc/conf.d/autofs}} file and edit the {{ic|daemonoptions}} line:<br />
daemonoptions='--timeout=5'<br />
<br />
* To enable logging (default is no logging at all), add {{ic|--verbose}} to the {{ic|daemonoptions}} line in {{ic|/etc/conf.d/autofs}} e.g.:<br />
daemonoptions='--verbose --timeout=5'<br />
<br />
After restarting the {{ic|autofs}} daemon, verbose output is visible in {{ic|/var/log/daemon.log}}.<br />
<br />
=== Identify multiple devices ===<br />
If you use multiple USB drives/sticks and want to easily tell them apart, you can use AutoFS to set up the mount points and [[Udev]] to create distinct names for your USB drives. See [[Map Custom Device Entries with udev]] for instructions on setting up Udev rules.<br />
<br />
=== AutoFS permissions ===<br />
If AutoFS isn't working for you, make sure that the permissions of the templates files are correct, otherwise AutoFS will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:<br />
<br />
*0644 - /etc/autofs/auto.master<br />
*0644 - /etc/autofs/auto.media<br />
*0644 - /etc/autofs/auto.misc<br />
*0644 - /etc/conf.d/autofs<br />
<br />
In general, scripts (like previous {{ic|auto.net}}) should have executable ({{ic|chown a+x filename}}) bits set and lists of mounts shouldn't.<br />
<br />
If you are getting errors in {{ic|/var/log/daemon.log}} similar to this, you have a permissions problem:<br />
<br />
May 7 19:44:16 peterix automount[15218]: lookup(program): lookup for petr failed<br />
May 7 19:44:16 peterix automount[15218]: failed to mount /media/cifs/petr<br />
<br />
== External links and resources ==<br />
* FTP and SFTP usage with AutoFS is based on this Gentoo Wiki article: http://en.gentoo-wiki.com/wiki/Mounting_SFTP_and_FTP_shares<br />
* More information on SSH can be found on the [[SSH]] and [[Using_SSH_Keys|Using SSH Keys]] pages of this wiki.<br />
* Information on setting up NFS can be found here: [[NFS]]<br />
<br />
== Alternatives to AutoFS ==<br />
*[[Thunar#Thunar_Volume_Manager|Thunar Volume Manager]] is an automount system for users of the [[Thunar]] file manager.<br />
* Pcmanfm-fuse is a lightweight file manager with built-in support for accessing remote shares: https://aur.archlinux.org/packages.php?ID=22992<br />
* [[udiskie]] is a minimalistic automatic disk mounting service using udisks</div>
Teratomata