Читаем Linux программирование в примерах полностью

# mount -t iso9660 -o ro,loop shrike-i386-discl.iso /mnt/cdrom

/* Смонтировать его в /mnt/cdrom */

# cd /mnt/cdrom /* Перейти туда */

# ls /* Посмотреть файлы */

autorun              README.it             RELEASE-NOTES-fr.html

dosutils             README.ja             RELEASE-NOTES.html

EULA                 README.ko             RELEASE-NOTES-it.html

GPL                  README.pt             RELEASE-NOTES-ja.html

images               README.pt_BR          RELEASE-NOTES-ko.html

isolinux             README.zh_CN          RELEASE-NOTES-pt_BR.html

README               README.zh_TW          RELEASE-NOTES-pt.html

README-Accessibility RedHat                RELEASE-NOTES-zh_CN.html

README.de            RELEASE-NOTES         RELEASE-NOTES-zh_TW.html

README.es            RELEASE-NOTES-de.html RPM-GPG-KEY

README.fr            RELEASE-NOTES-es.html TRANS.TBL

# cd /* Сменить */

# umount /mnt/cdrom /* Демонтировать */

Возможность монтирования таким способом образа ISO 9660 особенно полезна при тестировании сценариев, создающих образы CD. Вы можете создать образ в обычном файле, смонтировать его и проверить, что он подготовлен правильно. Затем, убедившись, что все в порядке, можно скопировать образ на записываемый CD («прожечь» CD). Возможность кольцевого устройства полезна также для монтирования образов гибких дисков

<p>8.1.4. Демонтирование файловых систем: <code>umount</code></p>

Команда umount демонтирует файловую систему, удаляя ее содержимое из системной иерархии файлов. Использование следующее:

umount файл-или-устройство

Демонтируемая файловая система не должна быть занята. Это означает, что нет процессов с открытыми в файловой системе файлами и что ни у одного процесса текущий рабочий каталог не находится в этой файловой системе:

$ mount /* Показать, что смонтировано */

/dev/hda2 on / type ext3 (rw) /* / находится на настоящем устройстве */

none on /proc type proc (rw)

usbdevfs on /proc/bus/usb type usbdevfs (rw)

/dev/hda5 on /d type ext3 (rw) /* To же c /d */

none on /dev/pts type devpts (rw,gid=5,mode=620)

none on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

$ su /* Переключиться на суперпользователя */

Password: /* Пароль не отображается */

# cd /d /* Сделать /d текущим каталогом */

# umount /d /* Попытка демонтировать /d */

umount: /d: device is busy /* Doesn't work; it's still in use */

# cd / /* Сменить /d */

# umount /d /* Еще одна попытка демонтировать /d */

# /* Молчание золото: umount работает */

<p>8.2. Файлы для администрирования файловой системы</p>

Файл /etc/fstab[81] перечисляет файловые системы, которые могут быть смонтированы. Большинство из них монтируются автоматически, когда система загружается. Формат следующий:

устройство точка-монтирования тип-фс опции dump-freq fsck-pass

(dump-freq и fsck-pass являются административными особенностями, не относящимися к настоящему обсуждению). Например, на нашей системе файл выглядит следующим образом:

$ cat /etc/fstab

# device mount-point type options freq passno

/dev/hda3 / ext3 defaults 1 1 /* Корневая файловая система */

/dev/hda5 /d ext3 defaults 1 2

Перейти на страницу:

Похожие книги

C++ Primer Plus
C++ Primer Plus

C++ Primer Plus is a carefully crafted, complete tutorial on one of the most significant and widely used programming languages today. An accessible and easy-to-use self-study guide, this book is appropriate for both serious students of programming as well as developers already proficient in other languages.The sixth edition of C++ Primer Plus has been updated and expanded to cover the latest developments in C++, including a detailed look at the new C++11 standard.Author and educator Stephen Prata has created an introduction to C++ that is instructive, clear, and insightful. Fundamental programming concepts are explained along with details of the C++ language. Many short, practical examples illustrate just one or two concepts at a time, encouraging readers to master new topics by immediately putting them to use.Review questions and programming exercises at the end of each chapter help readers zero in on the most critical information and digest the most difficult concepts.In C++ Primer Plus, you'll find depth, breadth, and a variety of teaching techniques and tools to enhance your learning:• A new detailed chapter on the changes and additional capabilities introduced in the C++11 standard• Complete, integrated discussion of both basic C language and additional C++ features• Clear guidance about when and why to use a feature• Hands-on learning with concise and simple examples that develop your understanding a concept or two at a time• Hundreds of practical sample programs• Review questions and programming exercises at the end of each chapter to test your understanding• Coverage of generic C++ gives you the greatest possible flexibility• Teaches the ISO standard, including discussions of templates, the Standard Template Library, the string class, exceptions, RTTI, and namespaces

Стивен Прата

Программирование, программы, базы данных