Slackware hard disk partition with fdisk
This is a tutorial to partition hard disk for Slackware Linux using fdisk partitioning tool. Before proceeding with hard disk partitioning, you need to plan on how do you want your partition to be. Make a proper plan to assign suitable size for each partition. If you haven't done so, here is a basic idea of dividing a 10 GB hard disk:
- swap - Two times your RAM size.
- /home - 2 GB
- /usr/local - 2 GB
- / - Take all the rest.
Of course you can replace /home with /var if you want. So /home will be in the / partition and share hard disk space with /. If you are really a Linux beginner, then you really need to know what partition doing what. Again here's a basic guide:
- swap - Virtual memory. This partition will help a low memory problem.
- / - This is the root partition. Your Slackware binary files will be installed here.
- /home - User's home directory. Users keep their files here. FTP home directory is here too.
- /var - System log files and email spools.
- /usr/local - Non official software or software packages that you added after the installation.
- /tmp - Store a temporary files.
There is another tutorial about hard disk partition that explains more about partition size. If you still unsure about what size you should give to each partition, check Setup Linux partitions in the Basic Slackware Linux learning guidelines for beginner tutorial.
Why do we consider all the mount points above to have their own partition? The reason is it'll be easier when you are going to upgrade Slackware. If user's file is in their own /home partition, then you don't have to backup when doing the upgrade. The same goes for logs and softwares because the only partition changed is the / partition.
For more information about hard disk partition and fdisk, you can check previous version of Slackware's tutorial in Linux hard disk partition - preparation, partition size and fdisk tutorial.
This is the main screen of fdisk partitioning tool. Press m to see what can you do with fdisk. Remember, press m if you need help.
This is the fdisk command action help menu. You don't have to remember all the list. Just pres m at fdisk main screen to view this help menu again if you need help. Here are the Linux fdisk menus that we are going to use to create hard disk partition not including the m for help menu:
- d - Delete a partition.
- n - Add a new partition.
- p - Print the partition table.
- q - Quit the partition without saving.
- t - Change a partition system id.
- w - Write table to disk and exit.
You can try other commands if you want. No harm done until you press w, which will write all the changes you made to the hard disk partition.
Press n to create a new partition table with fdisk. You'll be prompted with an action menu to choose. Choose the Primary partition by entering p.
If you are planning to make a separate partition for a certain mount points and need more than 4 partitions, you can choose the third partition to an extended partition. You can create as many partition as you want.
Use fdisk to create partition one. This would be the swap partition according to my plan.
You have an option to specify the cylinder to use for the first partition. You can safely use default here. So I just press enter to use the default cylinder here.
The important task here is to specify a size for the new partition. That's why I urge you to plan how to partition the hard disk before we start. So, according to my plan, we are going to create a swap partition for the first partition. My RAM size is 512MB, then the swap partition size would be 1024MB.
Remember, you must put + sign before the size and M after the size. The + sign would make our partition size flexible and M is for MB.
Press p to view the partition table we've just created.
Create a second partition with fdisk. You just repeat the steps before to create a second partition. Here's the summary:
- n - Create a new partition.
- p - Create a primary partition.
- Use default cylinder.
- Choose size for the new partition in +sizeM format.
- p - Print partition table.
Create fourth primary partition. Follow step 6 procedure. Because this is the last partition, I didn't specify the size. That means, just takes all the remaining spaces.
We already create a swap space in the first primary partition. However that is still a Linux system partition not a swap partition. We need to change the system id to make it the Linux swap partition type.
Press t to change the system id.
Command (m for help): t |
Choose partition number 1.
Partition number (1-4): 1 |
Enter L to list hex codes.
Hex code (type L to list codes): L |
Hex codes system id.
Hex codes system id is a unique id for file system type including Windows, Unix and Linux file system. The table below shows all the hex codes system id:
Hex code (type L to list codes): l 0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris 1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT- 2 XENIX root 39 Plan 9 82 Linux swap c4 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c7 Syrinx 5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data 6 FAT16 42 SFS 86 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility 8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt 9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee GPT f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b 11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f1 SpeedStor 12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f2 DOS secondary 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT Hex code (type L to list codes): |
As you can see from the screenshot above, the Linux system id is 83. A swap system id is 82. This is standard id. You can't see this in other distributions, can't you? The old Redhat maybe...
This is the final step. If you are sure, press w to write partition table to disk. If you want to delete a partition, press d. If you want to quit without save. press q. If you want to set a bootable disk to a partition, press a. It doesn't matter anyway.
To continue Slackware 12.1 installation, heading for the next screenshots, Slackware Linux Setup program.
Popular content


Post new comment