Книга: Fedora™ Unleashed, 2008 edition
Mounting the New Partition and Populating It with the Relocated Files
Mounting the New Partition and Populating It with the Relocated Files
For the example that follows, it is assumed that /home
was a directory that was part of the partition mounted at /, not a separate partition to begin with.
Here, we create a temporary mount point and mount the new partition:
# mkdir /mnt/newpartition
# mount -t ext3 /dev/hdb1 /mnt/newpartition
It is now time to copy all the files from /home
to /mnt/newpartition
. It is important that we preserve the time and date stamps for the files and the permissions. We're copying entire directories and subdirectories, so we use the one of three basic copying methods (tar
, cpio
, or cp
) that best accommodates this:
# cp -a /home/* /mnt/newpartition
We need to modify /etc/fstab
so that the new ext3
partition will be mounted correctly:
/dev/hdb1 /home ext3 defaults 1 2
Here, we have chosen to use the default mount
options for the ext3
partition. The defaults are identical to those for the ext2
file system, and additionally selects the default data=ordered
journaling mode.
Anytime we reboot, the new partition containing the copied files will automatically be mounted at /home
. But before we do that, we must cd
to /home
and enter this:
# touch thisistheoldhomepartition
Now we can mount the new partition:
# umount /mnt/newpartition
# mount /dev/hdb1 /home
Note that if you enter:
# ls -al /home
you will not see the thisistheoldhomepartition
file we created with the touch
command. So, what happened to the old files? They are still there, but just hidden because we mounted a directory "over" them. When we are satisfied that all is well, we can unmount the newly created home partition and delete the files in the partition that contains the thisistheoldhomepartition
file.
TIP
You can use the previously explained technique as a placeholder or warning for any temporarily mounted file system so that you do not mistakenly think that the file system is mounted when it is not.
- Разработка приложений баз данных InterBase на Borland Delphi
- 4.4.4 The Dispatcher
- Open Source Insight and Discussion
- Introduction to Microprocessors and Microcontrollers
- About the author
- Chapter 6. Traversing of tables and chains
- Chapter 7. The state machine
- Chapter 8. Saving and restoring large rule-sets
- Chapter 11. Iptables targets and jumps
- Chapter 5 Installing and Configuring VirtualCenter 2.0
- Chapter 16. Commercial products based on Linux, iptables and netfilter
- Appendix A. Detailed explanations of special commands