3933 |
|
|
3934 |
|
|
3935 |
|
|
3936 |
|
Managing partitions |
3937 |
|
============================================================================== |
3938 |
|
|
3939 |
|
Intro |
3940 |
|
**************************************** |
3941 |
|
One of the most important maintenance tasks that can only be done by using |
3942 |
|
a live CD is partitioning. No operating system allows partitioning the |
3943 |
|
same disk where the OS itself resides. Trying to do so is like attempting |
3944 |
|
to repair a car while its engine is turned on. |
3945 |
|
|
3946 |
|
Of course, SystemRescueCD contains multiple programs that are related to |
3947 |
|
partitioning. Most important are GParted (graphical partitioning program), |
3948 |
|
GNU Parted (text-based partitioning program), fdisk and sfdisk (partition |
3949 |
|
table editors) and various filesystem tools (like ntfsprogs and e2fsprogs). |
3950 |
|
|
3951 |
|
This page contains some theory about partitions and filesystems, advice for |
3952 |
|
choosing the right filesystem and a partitioning example by using GParted. |
3953 |
|
|
3954 |
|
[[ important.png ]] |
3955 |
|
While partitioning, an user error or a bug can damage your |
3956 |
|
partitions.Creating a disk image of the disk to bepartitioned beforehand |
3957 |
|
is highly recommended. |
3958 |
|
|
3959 |
|
[[ info.png ]] |
3960 |
|
The following pressentation has been made usingSystemRescueCD v 1.4.0 |
3961 |
|
|
3962 |
|
Some theory |
3963 |
|
**************************************** |
3964 |
|
What is a partition? |
3965 |
|
--------------------- |
3966 |
|
A partition is a logical division of a hard disk created so that you can |
3967 |
|
have different operating systems on the same hard disk or to create the |
3968 |
|
appearance of having separate hard drives for file management, multiple |
3969 |
|
users, or other purposes. |
3970 |
|
|
3971 |
|
In Windows, a one-partition hard disk is labelled the "C:" drive ("A:" and |
3972 |
|
"B:" are typically reserved for diskette drives). A two-partition hard drive |
3973 |
|
would typically contain "C:" and "D:" drives. (CD-ROM drives typically are |
3974 |
|
assigned the last letter in whatever sequence of letters have been used |
3975 |
|
as a result of hard disk formatting, or typically with a two-partition, |
3976 |
|
the "E:" drive.). |
3977 |
|
|
3978 |
|
In UNIX-based systems, a partition is used to host the / (root) file system, |
3979 |
|
and optionally the /opt, /usr and /home file systems. There may also be |
3980 |
|
a swap partition, which doesn't host any file system. |
3981 |
|
|
3982 |
|
Each operatin system provides some kind of tool to create and manage |
3983 |
|
partitions. Examples of such tools are fdisk in DOS/Windows, fdisk, sfdisk |
3984 |
|
and parted in Linux, etc. |
3985 |
|
|
3986 |
|
What is the difference between primary, extended and logical partitions? |
3987 |
|
--------------------- |
3988 |
|
Information about partitions is saved in so-called partition table |
3989 |
|
in Master Boot Record. MBR itself is only 512 bytes in size, |
3990 |
|
and only 64 bytes are reserved for partition table. That's not |
3991 |
|
enough, and there are many workarounds to bypass limitations |
3992 |
|
caused by the size, for example logical block addressing {{ |
3993 |
|
http://en.wikipedia.org/wiki/Logical_block_addressing#LBA.2C_ATA_devices_and_Enhanced_BIOS |
3994 |
|
}}. Extended partitions are another workaround. |
3995 |
|
|
3996 |
|
Partition table can only store information about four partitions. If one |
3997 |
|
has, for example, two GNU/Linux distributions on the same disk, both of |
3998 |
|
them having separate root partitions, shared /home and shared swap, the |
3999 |
|
partition number limit has been hit already. |
4000 |
|
|
4001 |
|
A partition that is mentioned in the partition table is called primary |
4002 |
|
partition. Because of the limit, one disk can only contain 1-4 primary |
4003 |
|
partitions. |
4004 |
|
|
4005 |
|
An extended partition fixes the problem simply by containing more boot |
4006 |
|
records, called Extended Boot Records (EBR). Each EBR contains information |
4007 |
|
about one logical partition and, if the extended partition contains multiple |
4008 |
|
logical partitions, link to the next EBR. Thus, an extended partition can |
4009 |
|
contain unlimited amount of logical partitions. |
4010 |
|
|
4011 |
|
Extended partition contains only EBRs and logical partitions (and maybe |
4012 |
|
unallocated space). Extended partition doesn't contain any filesystem and |
4013 |
|
files can't be stored in it. Of course, logical partition can contain any |
4014 |
|
filesystem (or be unformatted). |
4015 |
|
|
4016 |
|
Extended partition itself must be primary partition: an extended partition |
4017 |
|
can't be within another extended partition. In addition, a disk can contain |
4018 |
|
only one extended partition. |
4019 |
|
|
4020 |
|
Logical partitions can always be used for storing data: any operating system |
4021 |
|
can see logical partitions. GNU/Linux distributions can be installed to |
4022 |
|
logical partitions as well, but Windows requires a lot of tweaking. See |
4023 |
|
this outdated guide {{ http://www.goodells.net/multiboot/index.htm }}. |
4024 |
|
|
4025 |
|
What is LVM? |
4026 |
|
--------------------- |
4027 |
|
LVM means "Logical Volume Manager". It allows creating volume groups on top |
4028 |
|
of hard drives and logical volumes within volume groups. Logical volumes |
4029 |
|
are NOT the same thing as logical partitions! |
4030 |
|
|
4031 |
|
Volume groups can be created very flexibly: a volume group can allocate, |
4032 |
|
for example, the first half of the first hard drive and the second half |
4033 |
|
of the third drive. One can even create a massive volume group containing |
4034 |
|
all storage he/she has. |
4035 |
|
|
4036 |
|
The computer sees a logical volume as a partition: logical volume can be |
4037 |
|
left unformatted or contain any filesystem. |
4038 |
|
|
4039 |
|
LVM has many benefits: for example, if one has three hard drives 60 gigabytes |
4040 |
|
each, he/she can create a 160-gigabyte partition for storing massive files |
4041 |
|
and/or saving some disk space. In addition, logical volumes can be resized |
4042 |
|
even when they're in use, so when creating logical volumes one doesn't need |
4043 |
|
to worry if they're too small or big - if they are, he/she can resize them |
4044 |
|
at any time. |
4045 |
|
|
4046 |
|
However, resizing a logical volume doesn't resize the filesystem in |
4047 |
|
it, so using a filesystem that can be resized in use (online resizing) |
4048 |
|
is recommended. Very few filesystems can be shrinked online, but most |
4049 |
|
GNU/Linux filesystems (including ext3/4, ReiserFS, XFS and btrfs) can be |
4050 |
|
grown online. It's generally a good idea to leave unallocated space within |
4051 |
|
volume group, so logical volumes can later be grown without shrinking any |
4052 |
|
other logical volume. |
4053 |
|
|
4054 |
|
Here come bad news for people who dualboot: Windows doesn't support LVM, it |
4055 |
|
sees volume groups as unformatted partitions. If you try to access volume |
4056 |
|
group within Windows, you're just prompted to format the partition. That |
4057 |
|
prompt is annoying at best and dangerous at worst. |
4058 |
|
|
4059 |
|
More information about LVM can be found here (almost everything about LVM |
4060 |
|
in a single page) and here (official SystemRescueCD documentation about LVM). |
4061 |
|
|
4062 |
|
What is a file system? |
4063 |
|
--------------------- |
4064 |
|
A file system is the way in which files are named and where they are placed |
4065 |
|
logically for storage and retrieval. The DOS, Windows, OS/2, Macintosh, |
4066 |
|
and UNIX-based operating systems all have file systems in which files are |
4067 |
|
placed somewhere in a hierarchical (tree) structure. A file is placed in |
4068 |
|
a directory (folder in Windows) or subdirectory at the desired place in |
4069 |
|
the tree structure. |
4070 |
|
|
4071 |
|
The most important difference between filesystems is operating system |
4072 |
|
support. Some filesystems are supported by all modern operating systems, |
4073 |
|
but especially the newest filesystems are very rarely supported. Other |
4074 |
|
important limits are maximum file size, journaling support and file |
4075 |
|
permission metadata support. |
4076 |
|
|
4077 |
|
The reason that file size limits exist is that all filesystems reserve a |
4078 |
|
fixed number of bits for storing the file size. If the size of the file, |
4079 |
|
in bytes, is bigger than the biggest number that can be stored in file |
4080 |
|
size bits, the operating system must refuse to store the file at all in |
4081 |
|
order to prevent data corruption. |
4082 |
|
|
4083 |
|
File permission metadata means that the filesystem stores in the metadata |
4084 |
|
of the file, among other things, information about who owns the file and |
4085 |
|
what different users are allowed to do with the file. That metadata is |
4086 |
|
especially useful in multi-user environment because it mostly prevents |
4087 |
|
users from reading each other's files. Permissions can be bypassed, however. |
4088 |
|
|
4089 |
|
What is journaling? |
4090 |
|
--------------------- |
4091 |
|
Ideally, data in a partition never corrupts. But, in the real world, |
4092 |
|
there are power failures and operating system freezes. And if a computer |
4093 |
|
is forcefully shut down while something is written to the drive, the write |
4094 |
|
operation can't be finished. That can damage the filesystem and destroy |
4095 |
|
any files in the partition. |
4096 |
|
|
4097 |
|
Journaling partially fixes that problem by writing most changes to the |
4098 |
|
disk twice: first to a special area called journal and, after that, to |
4099 |
|
the filesystem itself. If power is lost while writing to the journal was |
4100 |
|
in progress, the partial change is just ignored and never committed to the |
4101 |
|
filesystem itself. If power failure or OS freeze happened while writing to |
4102 |
|
filesystem itself, the write operation is finished by using the information |
4103 |
|
in journal. |
4104 |
|
|
4105 |
|
Journaling helps most of the time when the computer has been forcefully |
4106 |
|
shut down, but not always. Due to performance reasons, only some |
4107 |
|
write operations are written to the journal, mostly the biggest |
4108 |
|
operations. Of course, journaling doesn't help if that particular |
4109 |
|
operation that was in progress while power was lost didn't go |
4110 |
|
through the journal. Journaling also doesn't protect from everything: |
4111 |
|
for example, using ext4 filesystem in conjuction with programs that |
4112 |
|
write a lot of files in a short time can result in massive data loss {{ |
4113 |
|
http://www.h-online.com/open/news/item/Possible-data-loss-in-Ext4-740467.html |
4114 |
|
}}, regardless if journaling is enabled or not. |
4115 |
|
|
4116 |
|
In addition, journaling reduces performance. It causes more writes to |
4117 |
|
the disk. That's not a big problem on mechanical hard drives, but on SSDs |
4118 |
|
(Solid State Drives) and thumb drives write speed is much slower than read |
4119 |
|
speed. They also have a limited number of writing cycles, so journaling |
4120 |
|
reduces their lifetime. I (Jyrki) actually use ext2 and FAT32 filesystems |
4121 |
|
on my external SSD drive because they do NOT support journaling at all. |
4122 |
|
|
4123 |
|
What are the differences between most popular filesystems? |
4124 |
|
--------------------- |
4125 |
|
The following table quickly describes the most important differences |
4126 |
|
between them. |
4127 |
|
|
4128 |
|
Operating system support |
4129 |
|
############################################################################# |
4130 |
|
Under Under Maximum Journaling Permissions |
4131 |
|
Windows GNU/Linux file size |
4132 |
|
############################################################################# |
4133 |
|
FAT32 Native Built-in 4 GB No No |
4134 |
|
NTFS Native Included 16 EB Yes Yes |
4135 |
|
ext2 3rd party driver Native 16 GB-2 TB* No Yes |
4136 |
|
ext3 3rd party driver Native 16 GB-2 TB* Yes Yes |
4137 |
|
ext4 No Native 16 GB-16 TB* Yes Yes |
4138 |
|
exFAT Native (Vista/7)** No 64 ZB No Yes |
4139 |
|
|
4140 |
|
* Depends on cluster size |
4141 |
|
** This update {{ http://support.microsoft.com/kb/955704 }} adds exFAT |
4142 |
|
support to Windows XP |
4143 |
|
|
4144 |
|
Operating system support: |
4145 |
|
|
4146 |
|
* "Native" means that the kernel supports the filesystem and the OS can |
4147 |
|
boot from a partition using that FS. |
4148 |
|
* "Built-in" means that the kernel supports the filesystem, but booting |
4149 |
|
from a partition containing such FS is very difficult. |
4150 |
|
* "Driver included" means that ntfs-3g (the driver that adds NTFS support |
4151 |
|
to Linux) comes with most GNU/Linux distributions. |
4152 |
|
* "3rd party driver" means that drivers to add filesystem support are |
4153 |
|
available, but must be downloaded and installed separately. The drivers |
4154 |
|
are Ext2 IFS and Ext2fsd. |
4155 |
|
* "No" means that there is no way to use the filesystem within the |
4156 |
|
operating system. |
4157 |
|
|
4158 |
|
Filesystems |
4159 |
|
**************************************** |
4160 |
|
This section contains more information about most popular filesystems. |
4161 |
|
|
4162 |
|
FAT32 |
4163 |
|
--------------------- |
4164 |
|
The initial version of FAT (File Allocation Table), now referred as |
4165 |
|
FAT12, was designed for floppy disks. A FAT12 partition can only be up |
4166 |
|
to 32 megabytes in size. After that, PCs equipped with hard drives were |
4167 |
|
introcuded by IBM and the sizes of hard drives began growing. Microsoft |
4168 |
|
answered the need by developing first initial FAT16 and then final FAT16. |
4169 |
|
|
4170 |
|
FAT16 partition can be up to two gigabytes in size. In the middle of 1990s, |
4171 |
|
that limit was becoming a problem. Microsoft pushed the limit up by updating |
4172 |
|
FAT again. |
4173 |
|
|
4174 |
|
FAT32 was first introduced with Windows 95 OSR2. Windows 98, |
4175 |
|
Windows Me, Windows 2000 and newer support FAT32 too. Linux |
4176 |
|
kernel has supported FAT32 almost as long as Windows, but |
4177 |
|
booting GNU/Linux from FAT32 partition is difficult and actually |
4178 |
|
requires DOS to be installed in the partition as well. (more information {{ |
4179 |
|
http://en.wikipedia.org/wiki/FAT_filesystem_and_Linux#Installing_Linux_on_and_booting_it_from_FAT_volumes_using_umsdos |
4180 |
|
}}) |
4181 |
|
|
4182 |
|
FAT32 partition can be up to two terabytes in size. As of now (March 2010), |
4183 |
|
there are hard drives that hit the limit, but don't exceed it. A single |
4184 |
|
file within FAT32 partition can be up to four gigabytes in size. |
4185 |
|
|
4186 |
|
Because FAT32 is, in the end, based on FAT12, it has very few features. It |
4187 |
|
doesn't support file permissions, hard/symbolic links, encryption, |
4188 |
|
compression, alternative data streams, journaling... It lacks support for |
4189 |
|
nearly anything that defines a modern filesystem. However, due to very |
4190 |
|
few features, FAT32 is very fast filesystem if it's not fragmented or on |
4191 |
|
a Flash-based drive. Mind you, FAT32 fragments very fast. |
4192 |
|
|
4193 |
|
Due to excellent operating system support, I recommend FAT32 for storing |
4194 |
|
files which should be accessible in both Windows and GNU/Linux. FAT32 |
4195 |
|
is also a good filesystem on Solid State Drives and thumb drives due to |
4196 |
|
its performance. |
4197 |
|
|
4198 |
|
ext2 |
4199 |
|
--------------------- |
4200 |
|
Ext2 or ext2fs is the successor of extfs (extended file system). Extfs |
4201 |
|
didn't support separated timestamps for access, data modification and inode |
4202 |
|
modification. In order to add support for them, and make the filesystem |
4203 |
|
extendable, a new filesystem had to be created. |
4204 |
|
|
4205 |
|
Ext2 was developed in January 1993, earlier than any other filesystem |
4206 |
|
mentioned in this page. |
4207 |
|
|
4208 |
|
Because ext2 is designed for GNU/Linux, support in Linux kernel was |
4209 |
|
implemented immediately. The first Windows driver supporting ext2, |
4210 |
|
Ext2fsd 0.01, was released on 25 January 2002. Both Windows drivers |
4211 |
|
for ext2 work only on Windows NT operating systems (NT 4.0 up to Vista, |
4212 |
|
7 isn't supported yet). |
4213 |
|
|
4214 |
|
The best property of ext2 is extensibility. The superblock contains |
4215 |
|
information about which version the filesystem is (ext2, ext3 or ext4) |
4216 |
|
and which extensions and features are in use. By using these pieces of |
4217 |
|
information, the operating system or driver can decide whether or not |
4218 |
|
mounting the partition is safe. That's the most important reason why most |
4219 |
|
GNU/Linux distributions still use successors of ext2 as default filesystems. |
4220 |
|
|
4221 |
|
Depending on cluster size, ext2 partition can be up to 2-32 terabytes in |
4222 |
|
size. File size limit is 16 GB-2 TB. |
4223 |
|
|
4224 |
|
Ext2 supports file permissions, both hard and symbolic links and extended |
4225 |
|
file attributes. Encryption, compression and journaling are unsupported. |
4226 |
|
|
4227 |
|
Due to lack of journaling support and existence of Windows drivers, I |
4228 |
|
recommend using ext2 if you're going to install GNU/Linux on a SSD drive |
4229 |
|
and want to be able to access files within Windows too. In fact, that's |
4230 |
|
exactly the setup I have. |
4231 |
|
|
4232 |
|
However, lack of journaling support is the worst limitation of ext2. And |
4233 |
|
what was done in order to get rid of the limitation? |
4234 |
|
|
4235 |
|
ext3 |
4236 |
|
--------------------- |
4237 |
|
Ext3, the successor of ext2, was introduced in Linux kernel on November |
4238 |
|
2001. It supports journaling, can be grown online and indexes large |
4239 |
|
directories. |
4240 |
|
|
4241 |
|
Ext2 IFS and Ext2fsd can mount ext3 partition as ext2 if the journal |
4242 |
|
is empty. (If it's not, something is wrong - journal is always emptied |
4243 |
|
when the partition is unmounted or the computer is shut down.) Thus, |
4244 |
|
ext3 support under Windows is just as good/bad as ext2 support. |
4245 |
|
|
4246 |
|
Partition and file size limits are the same as in ext2: partition size |
4247 |
|
limit is 2-32 TB and file size limit 16 GB-2 TB, depending on cluster size. |
4248 |
|
|
4249 |
|
Due to journaling support and existence of Windows drivers, ext3 is a good |
4250 |
|
choice if you're going to install GNU/Linux on a mechanical hard drive |
4251 |
|
and want to be able to access files within Windows. |
4252 |
|
|
4253 |
|
ext4 |
4254 |
|
--------------------- |
4255 |
|
Linux kernel support for ext4, the successor of ext3, was marked stable |
4256 |
|
code on October 2008. Ext4 contains multiple performance and stability |
4257 |
|
improvements over ext3. |
4258 |
|
|
4259 |
|
The most important new feature is extents. An extent is a contiguous area of |
4260 |
|
storage that has been reserved for a file. When a process starts to write |
4261 |
|
to a file, the whole extent is allocated even before the write operation |
4262 |
|
begins. The idea is that even if the file is larger than expected, it |
4263 |
|
doesn't fragment if it doesn't exceed the size of the extent. |
4264 |
|
|
4265 |
|
Another important improvement is larger partition size limit: an ext4 |
4266 |
|
partition can be even one exabyte in size. (An exabyte is a million |
4267 |
|
terabytes.) In addition, a directory within an ext4 partition can contain up |
4268 |
|
to 64 000 subdirectories (instead of 32 000, as in ext2/3) and timestamps |
4269 |
|
are much more accurate. The file size limit is 16 GB-16 TB, depending on |
4270 |
|
cluster size. |
4271 |
|
|
4272 |
|
Unfortunately, Ext2 IFS and Ext2Fsd don't support ext4 and are unable |
4273 |
|
to mount ext4 partition if extents are enabled. They can be disabled, |
4274 |
|
but other improvements of ext4 aren't that important for most people - |
4275 |
|
using ext2 or ext3 is just easier. |
4276 |
|
|
4277 |
|
Due to its features, ext4 is a good filesystem on computers that only have |
4278 |
|
GNU/Linux installed. Because journaling can be disabled, it is suitable |
4279 |
|
for Solid State Drives and thumb drives too. |
4280 |
|
|
4281 |
|
NTFS |
4282 |
|
--------------------- |
4283 |
|
At the end of 1980s, IBM and Microsoft were developing OS/2 operating |
4284 |
|
system. Both companies expected OS/2 1.1, released on 1988, to be the first |
4285 |
|
popular operating system having a GUI, Presentation Manager. Even though it |
4286 |
|
didn't become too popular during its first years, Microsoft didn't complain: |
4287 |
|
Windows 2 didn't sell any better. |
4288 |
|
|
4289 |
|
But on May 1990, Microsoft released Windows 3.0. Millions of copies of it |
4290 |
|
were sold during its first year, and Microsoft began to believe that OS/2 |
4291 |
|
had failed due to decisions of IBM. At autumn 1990, Microsoft stopped |
4292 |
|
cooperating with IBM, recasted OS/2 3.0 as Windows NT and continued |
4293 |
|
developing it alone, leaving IBM alone with OS/2. |
4294 |
|
|
4295 |
|
Windows NT was targeted for network file servers, and there were already |
4296 |
|
competition, most importantly Novell NetWare and OS/2. Among other things, |
4297 |
|
the filesystem of Windows NT had to be fast, space efficient and reliable. |
4298 |
|
|
4299 |
|
NTFS (New Technology File System) was introcuded with Windows NT 3.1. Newer |
4300 |
|
versions of NTFS have been introduced with newer versions of Windows NT, |
4301 |
|
and the filesystem is most likely still under development. All versions |
4302 |
|
of Windows NT support NTFS, but support in Linux kernel was implemented |
4303 |
|
as late as on December 2003. |
4304 |
|
|
4305 |
|
NTFS is still, in my opinion, the most feature-filled filesystem around. It |
4306 |
|
supports file permissions, both hard and symbolic links, encryption, |
4307 |
|
compression, alternative data streams, journaling... There are very few |
4308 |
|
features NTFS doesn't support. |
4309 |
|
|
4310 |
|
Depending on cluster size, a NTFS partition can be up to 8 ZB-1 YB in |
4311 |
|
size. (A zettabyte (ZB) is a milliard terabytes and a yottabyte (YB) |
4312 |
|
a billion terabytes.) File size limit is 16 EB. |
4313 |
|
|
4314 |
|
Windows 7 can only be installed on a NTFS |
4315 |
|
partition, and Vista requires a work-around {{ |
4316 |
|
http://www.computersplace.com/install-windows-vista-on-a-fat32-partition/windows-vista |
4317 |
|
}} if one wants to install it on a FAT32 partition. Of course NTFS partitions |
4318 |
|
can be used for data storage as well: due to features of NTFS, I recommend |
4319 |
|
doing so on mechanical hard drives on Windows-only computers. |
4320 |
|
|
4321 |
|
exFAT |
4322 |
|
--------------------- |
4323 |
|
NTFS is a great filesystem, but due to its complexity and journaling, it's |
4324 |
|
not suitable for Flash-based drives. Even Microsoft itself has recommended |
4325 |
|
using FAT32 on removable Flash media. |
4326 |
|
|
4327 |
|
However, FAT32 only allows files up to four gigabytes in size. The limit |
4328 |
|
is already becoming too small, for example a DVD disc image can exceed |
4329 |
|
that limit. In addition, FAT32 lacks file permission support. In order |
4330 |
|
to get rid of these limitations, Microsoft took FAT from its grave and |
4331 |
|
updated it one more time. |
4332 |
|
|
4333 |
|
ExFAT (extended FAT), also known as FAT64, was introduced with Windows CE |
4334 |
|
6.0, on November 2006. Windows Vista SP1, Windows 7 and newer support exFAT |
4335 |
|
too, and by installing this update {{ http://support.microsoft.com/kb/955704 |
4336 |
|
}} Windows XP can be extended to support exFAT as well. Unfortunately, |
4337 |
|
the only read-write exFAT driver for GNU/Linux (Tuxera exFAT for Embedded |
4338 |
|
Systems) is payware. |
4339 |
|
|
4340 |
|
The partition and file size limits of exFAT are the same: 64 |
4341 |
|
zettabytes. Another important improvement is file permission support that, |
4342 |
|
oddly, is lacking in Windows Vista. In addition, a directory within an |
4343 |
|
exFAT partition can contain up to 2 796 202 files (instead of 65 536, |
4344 |
|
as in FAT32) and timestamps have become more accurate. |
4345 |
|
|
4346 |
|
No operating system can be installed to an exFAT partition, so such |
4347 |
|
partitions can only be used for data storage. Due to lack of journaling |
4348 |
|
and support for huge files, exFAT is a good filesystem on Solid State |
4349 |
|
Drives and thumb drives that are only used within Windows Vista and/or 7. |
4350 |
|
|
4351 |
|
Partitioning example |
4352 |
|
**************************************** |
4353 |
|
This section contains a partitioning example. I simulate the following |
4354 |
|
situation in a virtual machine: |
4355 |
|
|
4356 |
|
I have two partitions in my disk: /dev/sda1 that contains a GNU/Linux |
4357 |
|
distribution, and /dev/sda2 that is a swap partition. Here we can see the |
4358 |
|
output of fdisk: |
4359 |
|
|
4360 |
|
root@sysresccd /root % fdisk -l |
4361 |
|
|
4362 |
|
Disk /dev/sda: 2097 MB, 2097152000 bytes |
4363 |
|
64 heads, 63 sectors/track, 1015 cylinders |
4364 |
|
Units = cylinders of 4032 * 512 = 2064384 bytes |
4365 |
|
Disk identifier: 0x00058a4a |
4366 |
|
|
4367 |
|
Device Boot Start End Blocks Id System |
4368 |
|
/dev/sda1 * 1 812 1636960+ 83 Linux |
4369 |
|
/dev/sda2 813 1015 409248 82 Linux swap / Solaris |
4370 |
|
|
4371 |
|
Now I'm going to install another distribution on the same disk. First of |
4372 |
|
all, I need one more partition, because only one distro can be installed on |
4373 |
|
one partition. In addition, I want to separate /home to its own partition |
4374 |
|
in order to be able to share it between distributions. |
4375 |
|
|
4376 |
|
Because the whole disk is already allocated, I must shrink at least one |
4377 |
|
existing partition in order to create new partitions. I'll shrink both of |
4378 |
|
them to half (/dev/sda1 from 1,6 gigabytes to 800 megabytes, and /dev/sda2 |
4379 |
|
from 400 MB to 200 MB). In addition, I'll move /dev/sda2 right next to |
4380 |
|
/dev/sda1 to keep the partitions in order. |
4381 |
|
|
4382 |
|
But how many partitions there will be in total? One, two, |
4383 |
|
three... four! Phew, I was near to paint myself into a corner. If I created |
4384 |
|
only primary partitions, I'd be unable to create any more partitions on |
4385 |
|
the disk. Thus, I'll create an extended partition instead and two logical |
4386 |
|
partitions within it. Then I'll be able to create more logical partitions |
4387 |
|
later if required. |
4388 |
|
|
4389 |
|
There is one more challenge: moving /home to a separate partition. It's |
4390 |
|
very easy to move the folder itself, but the distro in /dev/sda1 will |
4391 |
|
surely be confused if it doesn't find /home when it boots next time. Thus, |
4392 |
|
I must edit its /etc/fstab and configure it to mount the /home partition |
4393 |
|
automatically - before booting the distro itself. |
4394 |
|
|
4395 |
|
Now there are only two decisions left: the numbers and sizes of the new |
4396 |
|
partitions. I decide to install the new distro to /dev/sda5 and move /home |
4397 |
|
to /dev/sda6. Let /dev/sda5 be 800 megabytes and /dev/sda6 200 MB in size. |
4398 |
|
|
4399 |
|
Now it's time to boot into SystemRescueCD. Graphical mode is required |
4400 |
|
this time. |
4401 |
|
[[ systemrescuecd.png ]] |
4402 |
|
I close the terminal and open GParted by clicking the third icon in the |
4403 |
|
bottom pane. |
4404 |
|
[[ gparted-00.png ]] |
4405 |
|
I right-click the partition /dev/sda1 and select Resize/Move. |
4406 |
|
[[ gparted-01.png ]] |
4407 |
|
I enter 799 MB as the new size, click the Free Space Following (MiB) |
4408 |
|
combo box and press Resize/Move. |
4409 |
|
[[ gparted-02.png ]] |
4410 |
|
I right-click now /dev/sda2 and select Resize/Move. |
4411 |
|
[[ gparted-03.png ]] |
4412 |
|
I enter 0 MB as preceding free space and 200 MB as partition size, click |
4413 |
|
the Free Space Following (MiB) combo box and press Resize/Move. |
4414 |
|
[[ gparted-04.png ]] |
4415 |
|
I right-click the unallocated area and select New. |
4416 |
|
[[ gparted-05.png ]] |
4417 |
|
I select Extended Partition as the partition type. The size was already |
4418 |
|
998 megabytes (the maximum) and as said, an extended partition doesn't |
4419 |
|
contain any filesystem. I click Add. |
4420 |
|
[[ gparted-06.png ]] |
4421 |
|
I right-click the unallocated area within the extended partition and |
4422 |
|
select New. |
4423 |
|
[[ gparted-07.png ]] |
4424 |
|
I choose the ext4 filesystem and enter 798 MB as the partition size. After |
4425 |
|
that, I click first the Free Space Following (MiB) combo box and then Add. |
4426 |
|
[[ gparted-08.png ]] |
4427 |
|
I right-click the remaining unallocated space and select New one more time. |
4428 |
|
[[ gparted-09.png ]] |
4429 |
|
I choose the ext4 filesystem again. The partition size setting was already |
4430 |
|
201 megabytes (the whole available space), so I just press Add. |
4431 |
|
[[ gparted-10.png ]] |
4432 |
|
[[ important.png ]] |
4433 |
|
The next step is to commit the changes.After that some operations, for |
4434 |
|
examplepartition deletion, can no longer be undone. |
4435 |
|
|
4436 |
|
Finally I commit the changes by pressing the rightmost icon in the main bar. |
4437 |
|
[[ gparted-11.png ]] |
4438 |
|
After slowly reading the warning, I confirm my decisions by pressing Apply. |
4439 |
|
[[ gparted-12.png ]] |
4440 |
|
GParted begins to commit the changes... |
4441 |
|
[[ gparted-13.png ]] |
4442 |
|
...and when everything is done, it shows me this window that I close. |
4443 |
|
[[ gparted-14.png ]] |
4444 |
|
Then I can see the brand new partitions. |
4445 |
|
|
4446 |
|
Moving /home |
4447 |
|
--------------------- |
4448 |
|
I close GParted and launch Terminal by pressing the second icon in the |
4449 |
|
bottom pane. |
4450 |
|
|
4451 |
|
I create directories as mount points: |
4452 |
|
|
4453 |
|
mkdir /mnt/sda1 |
4454 |
|
mkdir /mnt/sda6 |
4455 |
|
|
4456 |
|
Then I mount the partitions: |
4457 |
|
|
4458 |
|
mount /dev/sda1 /mnt/sda1 |
4459 |
|
mount /dev/sda6 /mnt/sda6 |
4460 |
|
|
4461 |
|
I move the directory: |
4462 |
|
|
4463 |
|
mv /mnt/sda1/home/* /mnt/sda6/ |
4464 |
|
|
4465 |
|
After that, I unmount /dev/sda6, because it no longer needs to be mounted: |
4466 |
|
|
4467 |
|
sync |
4468 |
|
umount /dev/sda6 |
4469 |
|
[[ terminal.png ]] |
4470 |
|
As you can see, under Linux it's perfectly normal that the terminal doesn't |
4471 |
|
answer to the commands. Don't worry - they are really executed. |
4472 |
|
|
4473 |
|
Now I close Terminal and launch Geany by pressing the fourth icon in the |
4474 |
|
bottom pane. |
4475 |
|
[[ geany-00.png ]] |
4476 |
|
I select File -> Open. |
4477 |
|
[[ geany-01.png ]] |
4478 |
|
I press File System and navigate to folder /mnt/sda1/etc. |
4479 |
|
[[ geany-02.png ]] |
4480 |
|
I double-click the file fstab. |
4481 |
|
[[ geany-03.png ]] |
4482 |
|
I add the following line: |
4483 |
|
|
4484 |
|
/dev/sda6 /home ext4 defaults 0 2 |
4485 |
|
|
4486 |
|
Finally, I select File -> Save. |
4487 |
|
[[ geany-04.png ]] |
4488 |
|
It's a good idea to reboot the computer now and check if the distribution |
4489 |
|
in /dev/sda1 still works. Anyway, the disk should now be ready for the |
4490 |
|
new distro. |
4491 |
|
|
4492 |
|
|
4493 |
|
|
4494 |
|
|
4495 |
Identifying devices in Linux |
Identifying devices in Linux |
4496 |
============================================================================== |
============================================================================== |
4497 |
|
|
4701 |
Then I execute fdisk, which shows me that the disk contains one DOS and |
Then I execute fdisk, which shows me that the disk contains one DOS and |
4702 |
three Linux partitions. |
three Linux partitions. |
4703 |
|
|
4704 |
# fdisk -l /dev/hdb |
# fdisk -l /dev/sda |
4705 |
Disk /dev/sda: 160.0 GB, 160041885696 bytes |
Disk /dev/sda: 160.0 GB, 160041885696 bytes |
4706 |
255 heads, 63 sectors/track, 19457 cylinders |
255 heads, 63 sectors/track, 19457 cylinders |
4707 |
Units = cylinders of 16065 * 512 = 8225280 bytes |
Units = cylinders of 16065 * 512 = 8225280 bytes |