author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sat, 10 Feb 2018 01:28:53 +0200 | |
changeset 2227 | 1e9323e7ec88 |
parent 2053 | 536155417c5e |
child 2228 | 837f1337c59b |
permissions | -rw-r--r-- |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1195
diff
changeset
|
1 |
.. -*- coding: utf-8; -*- |
1195 | 2 |
|
3 |
============== |
|
4 |
File system. |
|
5 |
============== |
|
1346
a2fbf50a43f4
Fix: Has no 'contents::' directive.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
6 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1870
diff
changeset
|
7 |
:local: |
1195 | 8 |
|
1870
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
9 |
Supported FS. |
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
10 |
============= |
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
11 |
|
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
12 |
List of supported by current Linux kernel FSes:: |
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
13 |
|
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
14 |
$ cat /proc/filesystems |
6d3eb4fdcb47
List of supported by current Linux kernel FSes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
15 |
|
2052
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
16 |
FS stats |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
17 |
======== |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
18 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
19 |
Free space:: |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
20 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
21 |
$ df |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
22 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
23 |
Free space in MB:: |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
24 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
25 |
$ df -m |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
26 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
27 |
Free space in human readable format:: |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
28 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
29 |
$ df -h |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
30 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
31 |
Number of free nodes:: |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
32 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
33 |
$ df -i |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
34 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
35 |
FS limits |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
36 |
========= |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
37 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
38 |
``ext4`` uses 32-bit inode numbers so number of files limited to 2^32. |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
39 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
40 |
===== ==== ====== ======= ======= ======== |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
41 |
fs name inode sub-dir file fs total |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
42 |
===== ==== ====== ======= ======= ======== |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
43 |
ext2 255 2 TiB 16 TiB |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
44 |
ext3 255 32000 2 TiB 16 TiB |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
45 |
ext4 255 2^32 64000 16 TiB 16 TiB |
2053 | 46 |
btrfs 255 2^64 - 16 EiB 16 EiB |
2052
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
47 |
fat32 255 268e+6 2^16 2 GiB 8 TiB |
2053 | 48 |
ntfs 255 2^32 2^32 16 TiB 256 TiB |
2052
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
49 |
xfs 255 100 TiB 100 TiB |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
50 |
gfs2 255 100 TiB 100 TiB |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
51 |
===== ==== ====== ======= ======= ======== |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
52 |
|
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
53 |
https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
54 |
FS limits. |
005dc5fcaa0f
FS stats. FS limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1947
diff
changeset
|
55 |
|
1195 | 56 |
Make label on FAT32 volume. |
57 |
=========================== |
|
58 |
||
59 |
The volume name can be up to 11 characters long:: |
|
60 |
||
61 |
$ sudo mlabel -i /dev/<device> ::my-label |
|
62 |
||
63 |
or when create FAT32 file system:: |
|
64 |
||
65 |
$ sudo mkdosfs -n <vol-name> /dev/<device> |
|
66 |
||
67 |
Convert file name coding. |
|
68 |
========================= |
|
69 |
:: |
|
70 |
||
71 |
$ convmv --nosmart -f cp-1251 -t utf-8 -r $dir |
|
72 |
||
73 |
How get file time attributes. |
|
74 |
============================= |
|
75 |
||
76 |
POSIX define 3 file time attributes: atime (access time, only a few OS/fs update |
|
77 |
this parameter), ctime (attribute/inode modification time), mtime (modification |
|
78 |
time). |
|
79 |
||
80 |
To get time you can use 'ls' command but it print time in locale dependent |
|
81 |
irregular form:: |
|
82 |
||
83 |
$ ls -l file.txt # last file modification |
|
84 |
$ ls -lc file.txt # last file status modification |
|
85 |
$ ls -lu file.txt # last access |
|
86 |
||
87 |
GNU coreutils provide more robust 'stst' utility:: |
|
88 |
||
89 |
$ stat -c %Y file.txt # last file modification |
|
90 |
$ stat -c %Z file.txt # last file status modification |
|
91 |
$ stat -c %X file.txt # last access |
|
92 |
||
93 |
POSIX file name restriction. |
|
94 |
============================ |
|
95 |
||
96 |
Windows file name restriction. |
|
97 |
============================== |
|
98 |
||
99 |
http://msdn.microsoft.com/en-us/library/aa365247.aspx |
|
100 |
Naming Files, Paths, and Namespaces |
|
101 |
||
102 |
How get UUID and label? |
|
103 |
======================= |
|
104 |
||
105 |
Include UUID (Universally Unique Identifier) and labels:: |
|
106 |
||
107 |
$ ls -l /dev/disk/by-uuid/ |
|
108 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 46B6-1FD4 -> ../../sdb2 |
|
109 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 4C30299030298256 -> ../../sda1 |
|
110 |
||
111 |
$ ls -l /dev/disk/by-label/ |
|
112 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 bin -> ../../sda3 |
|
113 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 inst -> ../../sda2 |
|
114 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 media -> ../../sdc5 |
|
115 |
||
116 |
$ sudo vol_id /dev/dm-2 |
|
117 |
ID_FS_USAGE=filesystem |
|
118 |
ID_FS_TYPE=ext3 |
|
119 |
ID_FS_VERSION=1.0 |
|
120 |
ID_FS_UUID=f7484fc9-75ec-4e46-8539-50b1e371b7ef |
|
121 |
ID_FS_UUID_ENC=f7484fc9-75ec-4e46-8539-50b1e371b7ef |
|
122 |
ID_FS_LABEL= |
|
123 |
ID_FS_LABEL_ENC= |
|
124 |
ID_FS_LABEL_SAFE= |
|
125 |
||
126 |
$ /sbin/blkid ## from 'e2fsprogs' package |
|
127 |
/dev/sdc2: UUID="46B6-1FD4" TYPE="vfat" |
|
128 |
/dev/sdb2: TYPE="ntfs" UUID="BC48D3FD48D3B47C" LABEL="inst" |
|
129 |
/dev/sda5: UUID="5240AED140AEBB5D" LABEL="music" TYPE="ntfs" |
|
130 |
/dev/sdc1: UUID="81c4444f-0b70-429a-9d97-8c13e8651f5b" TYPE="ext3" |
|
131 |
/dev/sdc3: UUID="KOpHWz-clDR-2MqV-vAkE-cPvY-uZrY-kjYJIb" TYPE="lvm2pv" |
|
132 |
||
133 |
$ udevinfo --query=all --name /dev/sdb ## from 'udev' package |
|
134 |
P: /block/sdb |
|
135 |
N: sdb |
|
136 |
S: disk/by-id/ata-WDC_WD1600JS-00MHB0_WD-WCANM5835587 |
|
137 |
S: disk/by-id/scsi-SATA_WDC_WD1600JS-00_WD-WCANM5835587 |
|
138 |
S: disk/by-path/pci-0000:00:08.0-scsi-1:0:0:0 |
|
139 |
E: ID_VENDOR=ATA |
|
140 |
E: ID_MODEL=WDC_WD1600JS-00M |
|
141 |
E: ID_REVISION=02.0 |
|
142 |
... |
|
143 |
||
144 |
How set UUID and label? |
|
145 |
======================= |
|
146 |
||
147 |
For ext2/ext3 fs:: |
|
148 |
||
149 |
$ sudo tune2fs /dev/hdb1 -U `uuid` |
|
150 |
||
151 |
Linux fs under Windows. |
|
152 |
======================= |
|
153 |
||
1947 | 154 |
Ext2Fsd. |
155 |
-------- |
|
156 |
||
157 |
Ext2Fsd is an open source linux ext3/ext4 file system driver for Windows systems |
|
158 |
(NT/2K/XP/Win7/Win8, X86/AMD64) and only alive project. |
|
159 |
||
160 |
http://www.ext2fsd.com/ |
|
161 |
Home page. |
|
162 |
http://sourceforge.net/projects/ext2fsd/ |
|
163 |
Sourceforge home page. |
|
164 |
||
1195 | 165 |
Ext2 IFS. |
166 |
--------- |
|
167 |
||
168 |
It provides Windows NT4.0/2000/XP/2003/Vista/2008 with full access to Linux Ext2 |
|
169 |
volumes (read access and write access). This may be useful if you have installed |
|
170 |
both Windows and Linux as a dual boot environment on your computer. |
|
171 |
||
172 |
The "Ext2 Installable File System for Windows" software is freeware. |
|
173 |
||
174 |
After install use 'ifsdrives.cpl' control panel to modify settings. |
|
175 |
||
176 |
http://www.fs-driver.org/ |
|
177 |
home page |
|
178 |
||
179 |
rfstool. |
|
180 |
-------- |
|
181 |
||
182 |
Allows you to access ReiserFS partitions from a Windows 95/98/ME/NT/2000/XP |
|
183 |
system. It also allows you to access ReiserFS partitions from Linux. It is a |
|
184 |
complete rewrite of the ReiserFS functions needed to list directories, copy |
|
185 |
files, and backup metadata. |
|
186 |
||
187 |
http://p-nand-q.com/e/reiserfs.html |
|
188 |
home page |
|
189 |
http://freshmeat.net/projects/rfstool/ |
|
190 |
Freshmeat home page. |
|
191 |
||
192 |
Summary files size. |
|
193 |
=================== |
|
194 |
:: |
|
195 |
||
196 |
$ find . -type f -iname "*.log" -print0 | du --files0-from=- -c -m | tail -n 1 \ |
|
197 |
| (read first rest; echo $first) |
|
198 |
||
199 |
Mount NTFS in Linux. |
|
200 |
==================== |
|
201 |
||
202 |
Mount in rw mode:: |
|
203 |
||
204 |
$ man 8 ntfs-3g |
|
205 |
$ cat /etc/fstab |
|
206 |
... |
|
207 |
UUID=D474CB9874CB7C2C /mnt/winbin ntfs-3g rw,default_permissions,gid=1000,fmask=113,dmask=002,noatime,silent 0 0 |
|
208 |
... |
|
209 |
||
1493
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
210 |
Stop fsck running every 27 boots. |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
211 |
================================= |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
212 |
|
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
213 |
Check current settings:: |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
214 |
|
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
215 |
$ tune2fs -l /dev/$DISK |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
216 |
|
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
217 |
and tune them:: |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
218 |
|
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
219 |
$ tune2fs -c 0 /dev/$DISK |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
220 |
$ tune2fs -i 2w /dev/$DISK |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
221 |
|
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
222 |
Or disable checks in ``/etc/fstab`` completely (by setting last colon to ``0`` |
667fab70b4b1
Stop fsck running every 27 boots.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1346
diff
changeset
|
223 |
value)! |