1195
|
1 |
.. -*- coding: utf-8 -*-
|
|
2 |
|
|
3 |
==============
|
|
4 |
File system.
|
|
5 |
==============
|
|
6 |
|
|
7 |
Make label on FAT32 volume.
|
|
8 |
===========================
|
|
9 |
|
|
10 |
The volume name can be up to 11 characters long::
|
|
11 |
|
|
12 |
$ sudo mlabel -i /dev/<device> ::my-label
|
|
13 |
|
|
14 |
or when create FAT32 file system::
|
|
15 |
|
|
16 |
$ sudo mkdosfs -n <vol-name> /dev/<device>
|
|
17 |
|
|
18 |
Convert file name coding.
|
|
19 |
=========================
|
|
20 |
::
|
|
21 |
|
|
22 |
$ convmv --nosmart -f cp-1251 -t utf-8 -r $dir
|
|
23 |
|
|
24 |
How get file time attributes.
|
|
25 |
=============================
|
|
26 |
|
|
27 |
POSIX define 3 file time attributes: atime (access time, only a few OS/fs update
|
|
28 |
this parameter), ctime (attribute/inode modification time), mtime (modification
|
|
29 |
time).
|
|
30 |
|
|
31 |
To get time you can use 'ls' command but it print time in locale dependent
|
|
32 |
irregular form::
|
|
33 |
|
|
34 |
$ ls -l file.txt # last file modification
|
|
35 |
$ ls -lc file.txt # last file status modification
|
|
36 |
$ ls -lu file.txt # last access
|
|
37 |
|
|
38 |
GNU coreutils provide more robust 'stst' utility::
|
|
39 |
|
|
40 |
$ stat -c %Y file.txt # last file modification
|
|
41 |
$ stat -c %Z file.txt # last file status modification
|
|
42 |
$ stat -c %X file.txt # last access
|
|
43 |
|
|
44 |
POSIX file name restriction.
|
|
45 |
============================
|
|
46 |
|
|
47 |
Windows file name restriction.
|
|
48 |
==============================
|
|
49 |
|
|
50 |
http://msdn.microsoft.com/en-us/library/aa365247.aspx
|
|
51 |
Naming Files, Paths, and Namespaces
|
|
52 |
|
|
53 |
How get UUID and label?
|
|
54 |
=======================
|
|
55 |
|
|
56 |
Include UUID (Universally Unique Identifier) and labels::
|
|
57 |
|
|
58 |
$ ls -l /dev/disk/by-uuid/
|
|
59 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 46B6-1FD4 -> ../../sdb2
|
|
60 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 4C30299030298256 -> ../../sda1
|
|
61 |
|
|
62 |
$ ls -l /dev/disk/by-label/
|
|
63 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 bin -> ../../sda3
|
|
64 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 inst -> ../../sda2
|
|
65 |
lrwxrwxrwx 1 root root 10 2010-11-01 23:41 media -> ../../sdc5
|
|
66 |
|
|
67 |
$ sudo vol_id /dev/dm-2
|
|
68 |
ID_FS_USAGE=filesystem
|
|
69 |
ID_FS_TYPE=ext3
|
|
70 |
ID_FS_VERSION=1.0
|
|
71 |
ID_FS_UUID=f7484fc9-75ec-4e46-8539-50b1e371b7ef
|
|
72 |
ID_FS_UUID_ENC=f7484fc9-75ec-4e46-8539-50b1e371b7ef
|
|
73 |
ID_FS_LABEL=
|
|
74 |
ID_FS_LABEL_ENC=
|
|
75 |
ID_FS_LABEL_SAFE=
|
|
76 |
|
|
77 |
$ /sbin/blkid ## from 'e2fsprogs' package
|
|
78 |
/dev/sdc2: UUID="46B6-1FD4" TYPE="vfat"
|
|
79 |
/dev/sdb2: TYPE="ntfs" UUID="BC48D3FD48D3B47C" LABEL="inst"
|
|
80 |
/dev/sda5: UUID="5240AED140AEBB5D" LABEL="music" TYPE="ntfs"
|
|
81 |
/dev/sdc1: UUID="81c4444f-0b70-429a-9d97-8c13e8651f5b" TYPE="ext3"
|
|
82 |
/dev/sdc3: UUID="KOpHWz-clDR-2MqV-vAkE-cPvY-uZrY-kjYJIb" TYPE="lvm2pv"
|
|
83 |
|
|
84 |
$ udevinfo --query=all --name /dev/sdb ## from 'udev' package
|
|
85 |
P: /block/sdb
|
|
86 |
N: sdb
|
|
87 |
S: disk/by-id/ata-WDC_WD1600JS-00MHB0_WD-WCANM5835587
|
|
88 |
S: disk/by-id/scsi-SATA_WDC_WD1600JS-00_WD-WCANM5835587
|
|
89 |
S: disk/by-path/pci-0000:00:08.0-scsi-1:0:0:0
|
|
90 |
E: ID_VENDOR=ATA
|
|
91 |
E: ID_MODEL=WDC_WD1600JS-00M
|
|
92 |
E: ID_REVISION=02.0
|
|
93 |
...
|
|
94 |
|
|
95 |
How set UUID and label?
|
|
96 |
=======================
|
|
97 |
|
|
98 |
For ext2/ext3 fs::
|
|
99 |
|
|
100 |
$ sudo tune2fs /dev/hdb1 -U `uuid`
|
|
101 |
|
|
102 |
Linux fs under Windows.
|
|
103 |
=======================
|
|
104 |
|
|
105 |
Ext2 IFS.
|
|
106 |
---------
|
|
107 |
|
|
108 |
It provides Windows NT4.0/2000/XP/2003/Vista/2008 with full access to Linux Ext2
|
|
109 |
volumes (read access and write access). This may be useful if you have installed
|
|
110 |
both Windows and Linux as a dual boot environment on your computer.
|
|
111 |
|
|
112 |
The "Ext2 Installable File System for Windows" software is freeware.
|
|
113 |
|
|
114 |
After install use 'ifsdrives.cpl' control panel to modify settings.
|
|
115 |
|
|
116 |
http://www.fs-driver.org/
|
|
117 |
home page
|
|
118 |
|
|
119 |
Ext2Fsd.
|
|
120 |
--------
|
|
121 |
|
|
122 |
Ext2Fsd is an open source linux ext2/ext3 file system driver for Windows systems
|
|
123 |
(NT/2K/XP/VISTA, X86/AMD64).
|
|
124 |
|
|
125 |
http://www.ext2fsd.com/
|
|
126 |
Home page.
|
|
127 |
http://sourceforge.net/projects/ext2fsd/
|
|
128 |
Sourceforge home page.
|
|
129 |
|
|
130 |
|
|
131 |
rfstool.
|
|
132 |
--------
|
|
133 |
|
|
134 |
Allows you to access ReiserFS partitions from a Windows 95/98/ME/NT/2000/XP
|
|
135 |
system. It also allows you to access ReiserFS partitions from Linux. It is a
|
|
136 |
complete rewrite of the ReiserFS functions needed to list directories, copy
|
|
137 |
files, and backup metadata.
|
|
138 |
|
|
139 |
http://p-nand-q.com/e/reiserfs.html
|
|
140 |
home page
|
|
141 |
http://freshmeat.net/projects/rfstool/
|
|
142 |
Freshmeat home page.
|
|
143 |
|
|
144 |
Summary files size.
|
|
145 |
===================
|
|
146 |
::
|
|
147 |
|
|
148 |
$ find . -type f -iname "*.log" -print0 | du --files0-from=- -c -m | tail -n 1 \
|
|
149 |
| (read first rest; echo $first)
|
|
150 |
|
|
151 |
Mount NTFS in Linux.
|
|
152 |
====================
|
|
153 |
|
|
154 |
Mount in rw mode::
|
|
155 |
|
|
156 |
$ man 8 ntfs-3g
|
|
157 |
$ cat /etc/fstab
|
|
158 |
...
|
|
159 |
UUID=D474CB9874CB7C2C /mnt/winbin ntfs-3g rw,default_permissions,gid=1000,fmask=113,dmask=002,noatime,silent 0 0
|
|
160 |
...
|
|
161 |
|