Linux with Operating System Concepts


partitions or change the size of a partition? This can be a challenging problem



Download 5,65 Mb.
Pdf ko'rish
bet152/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   148   149   150   151   152   153   154   155   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014


partitions or change the size of a partition? This can be a challenging problem.
Consider, for instance, that you divided your file space into partitions where root is 
16 GB, swap is 32 GB, /usr is 100 GB, /var is 20 GB, and /home has the remainder of the 
disk space (say 830 GB to give you a total of approximately 1 TB of disk space). You now 
decide that you want to expand /usr from 100 GB to 200 GB and you want to add a parti-
tion for /usr/bin separate from /usr.
In making these changes, you will have to impinge on another partition’s space. You 
would not want to take this from / or /var as those are fairly small. The natural option is to 
take space from /home. However, in doing so, you must make sure that reducing the /home 
partition does not destroy data. For instance, if 700 GB of space has already been taken up 
in /home, reducing its size would necessarily result in a loss of data.
Before attempting to repartition your Linux file space, you should make sure that you 
have backed up the data partitions (/home, /var). This ensures that if you are encroaching 
on another partition’s disk space and the repartitioning deletes files, you have them avail-
able to be restored.
The parted program can be used to handle repartitioning. This is a command-line pro-
gram used to view, alter, add, and delete partitions. The program can run with or without 
user interaction. Typing parted drops you into the parted interpreter with a prompt of 
(parted). Now you enter partitioning commands.
There are numerous commands available. The more useful ones are listed in Table 10.3. 
The value NUMBER refers to the numeric value associated with the partition, which can 
be obtained through the print command. With certain options, parted runs without inter-
action, for instance, -l (or --list)does the same as the list command. You are unable to per-
form tasks such as mkpart, mkfs, and resize without the interactive interpreter.
You can also create a file system through the command line instructions 
mkfs
and 
mke2fs
. By using either of these two commands, you are able to specify file system options 
that are not provided in parted. For instance, mke2fs allows you to provide a stripe size if 
you are configuring the file system for use with RAID (see Chapter 14 for a discussion of 
RAID), or journaling options for an ext3- or ext4-type file system. For either command, 
you must specify the partition’s device name such as /dev/sda6.
Other options are available. If the specific type is not provided, mkfs defaults to ext2 
while mke2fs defaults to the type listed in the /
etc/mke2fs.conf
file.
10.4.5 Using a Logical Volume Manager to Partition
Instead of risking the need for repartitioning in the future, another option is to use a 
logical volume manager (LVM). LVM is an approach to disk partitioning where parti-
tions’ sizes are not physically imposed at the time of initial disk partitioning. Instead, 


412

Linux with Operating System Concepts
partitioning is done in somewhat of a virtual way. Or alternatively, you might think of 
LVM as a software layer residing over the physical disk where partitioning is handled 
through this software layer.
The way LVM works is to set up sets of partitions, called volumes. First, there are 
physi-
cal volumes
. The physical volumes are grouped together to form volume groups. The vol-
ume groups represent the sum total of the storage available for partitioning.
For instance, if you have two hard disk drives, /dev/sda1 and /dev/sdb1, these two can 
be united for a volume group. Now, partitioning can be done so that a partition is placed 
anywhere on either (or both) of the physical disk drives.
Note that the hard disk drives can still be physically partitioned but there is no longer a 
one-to-one mapping of a file system to a partition. Instead, the physical partitions become 
portions of a volume group.
A physical volume is itself made up of 
physical extents
(PE). The PEs are fixed in size,
*
much like the page/frame size of virtual memory. A physical volume then is a collection 
of PEs. The number of PEs for the physical volume is based on the PE size (dictated by the 
operating system) and the size of the physical volume itself. From our previous paragraph, 
imagine that /dev/sda1 is 1 TB and /dev/sdb1 is 512 GB in size. These two physical volumes 
combine for a single volume group of 1.5 TB. The PE sizes, for our example, are 4 MB. This 
gives us a total of over 393,000 PEs.
We now divide the volume group into partitions, known as 
logical volumes
. The logi-
cal volume is established with a certain minimum size and an estimated total size. 
*
To be more accurate, the PEs of Linux are fixed in size. Other operating systems may implement variable-sized PEs.
TABLE 10.3 
Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   148   149   150   151   152   153   154   155   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish