6

Till now I was windows user. From now on I want to use only Linux.

I have 500Gb HDD. How do I partition it properly? I read that there is no right or wrong way, but still, I am confused. I did something and I have primary partition mounted on / (160Gb) which I believe is a OS and 350Gb extended partition of which I have 4Gb of swap and 346Gb mounted on /home.

I got used to C:\ and D:\ partitioning, but I don't see file system in that way. I am lost. Where is what? How can I make C:\ partition for OS and D:\ for apps, movies, music, photos. Or what I want is Windows way and I have to get used to Linux way?

3
  • Basically, your "D: drive" is just deeper in the filesystem; the deepest partition to be mounted above where you are trying to write is the one that will be written to.
    – nanofarad
    Jul 19, 2012 at 13:30
  • @Damir: If someone's answer was helpful to you, then please consider marking it as the accepted answer so others may more easily find it in the future. This is also a polite way to thank the person answering your question for helping you out.
    – Danatela
    May 20, 2014 at 5:01

4 Answers 4

6

Linux is not all that different to MS-Windows:

Gnu/Linux an improved and Free Unix. MS-Windows is based on MS-Dos that is a poor clone of CPM that was inspired by Unix.

There is one main difference: Gnu/Linux and all Unixes have one root, one unified hierarchy, and therefore no drive letters. MS-Windows, DOS and CPM have multiple hierarchies, one for each drive/partition, they are given letters (e.g. c:). On Gnu/Linux home will be mounted on /home, it will be there no matter if it is on the same partition, a separate partition or a network share. The advantage of this approach is that the name of files is not dependant on the location of the storage device. The advantage of the Ms-Windows, dos, cpm way is that is was easier for the operating system programmers when they wrote the operating system.

Sub-trees (from other partition, disks or network share etc. ) can be grafted on, but there is one tree per computer. You can even share sub-trees between computers using network file shares, but they are sub-trees not new trees.

Type mount -l on a command line to see all mounts. Note this includes a few special mounts that have no backing store. Also df -h to get usage info.

Example from my system:

#how full are my filesystems.
df -h --print-type 
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda5     ext4     20G  9.7G  8.7G  53% /
tmpfs        tmpfs    1.5G     0  1.5G   0% /lib/init/rw
udev         tmpfs    1.5G  284K  1.5G   1% /dev
tmpfs        tmpfs    1.5G  4.0K  1.5G   1% /dev/shm
/dev/sda6     ext4     87G   64G   18G  79% /home
/dev/sdb2     ext4    230G   85G  133G  39% /media/extra

#detailed info on what is mounted, but no size or usage info.
mount -l
/dev/sda5 on / type ext4 (rw,dirsync,errors=remount-ro,barrier=1,data=journal,auto_da_alloc,journal_checksum) [debian]
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/sda6 on /home type ext4 (rw,dirsync,errors=remount-ro,barrier=1,data=journal,auto_da_alloc,journal_checksum) [debian-home]
fusectl on /sys/fs/fuse/connections type fusectl (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/dev/sdb2 on /media/extra type ext4 (rw,nosuid,nodev,uhelper=udisks) [extra]
  • The root file-system / [equivelent to c:] is on primary hard-disk partition.
  • On /lib/init/rw we have a temporary ram based file system. (probably used by init, process 1, probably best it ignore it)
  • on /proc we have the proc file-system. This is magic, it is a dynamic file-system, it can tell you lots of cool stuff about you processes/system.
  • on /sys we have the sys file-system. (see what I said about /proc)
  • on /dev we have udev. udev manages /dev. /dev is a where lots of magic lives, lots of things that you may not think of as files live there: partitions, audio/video input output, keyboard, mouse, a black-hole (/dev/null), a source of nothing (/dev/zero), etc.
  • on /home is another disk partition. This is where users directories are. [Equivalent to ?:\User on modern Microsoft os, where ? may be C, or something else].
  • on /media/extra is an external hard-disk. /media is a place that external drives get mounted on automatically. In /media is also a directories /media/cdrom and /media/cdrom0 the first a reference to the other. They are empty directories, but if I put in a cdrom. Then the cd appears here. [ Equivalent to random-letter-of-the-day:\]

more examples:

#what swap have I got, and what is being used.
/sbin/swapon -s
Filename        Type        Size      Used   Priority
/dev/sda7       partition   4095992   0      -1

#what disks and partitions have I got.
ls -l /dev/disk/by-path/*
lrwxrwxrwx 1 root root  9 Jul 15 22:39 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:1.1:1.0-scsi-0:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Jul 15 19:36 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:1.1:1.0-scsi-0:0:0:0-part2 -> ../../sdb2
lrwxrwxrwx 1 root root  9 Jul 15 22:39 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Jul 15 22:39 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 Jul 15 19:36 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Jul 15 19:36 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 Jul 15 19:36 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part7 -> ../../sda7
lrwxrwxrwx 1 root root  9 Jul 15 19:36 /dev/disk/by-path/pci-0000:00:1f.2-scsi-1:0:0:0 -> ../../sr0

/dev is the directory that raw devices live in. /dev/sd* are disk partitions. /dev/sda is primary hard disk /dev/sdb is secondary hard disk in my case an external one. /dev/sd?1 is first partition of a disk. 1,2,3,4 are primary partitions, 5,6,7,etc are secondary partitions.

2

What you can do is mounting different part of your system in different platforms (partitions). If a crash occurs, there will be less damages. An example of what you can do:

  • A partition with system data mounted on / 30 GB is enough
  • A swap if necessary (4GB for example)
  • The rest of your HDD in a partition dedicated to your personal data. It will be mounted on /home.

If Ubuntu crashes, your data are safe ! :)

1
  • 1
    The separate partition for user data, is not so much to protect from crash (that is the job of the file-system journal(ext3, ext4 et al. Another cool Linux thing, that is not in Windows). It is more to aid backup(backup is a way to protect from data loss), to make it easier to upgrade, in the case where you have to wipe the disk (but only the os partition), e.g. you broke the OS while tinkering as root (admin), or you are changing distribution. Jan 21, 2013 at 16:12
1

There are no C: or D: partitions in Linux, no drive letters at all. I've read through others answers but I don't think it's enough to "unconfuse" you. Here's the general idea, the "root" filesystem, i.e. the one that you install Ubuntu to, is /. Anything else resides "under" that filesystem, drives are "mounted" to folders. The common structure is to have / for everything, /home for the users' data and a swap partition, in order to hibernate and such.

0

Linux has no concept of drive letters. In linux everything is a file, even folders. Think of / as your "C" drive. Everything else is "mounted" underneath it. what you want to call your "D" drive would be your /home mount point. Program files would be your /usr and to some extent /var. In linux, the physical location of the data does not matter. It took me a while to understand that the concept of drive letters is unnecessary. A drive letter is another name for a mount point.

So, to keep it simple:

/ = C:

/home = D:\ for apps, movies, music, photos

and don't forget to create a swap file /swap ... that is your virtual memory. if you have less than 1GB of ram, make it 2X your total ram.

Though most of the experienced users would flog you for only having 3 partions, it will boot. Once you understand how the file system works better, you will most likely alter your partitioning scheme.

1
  • Why would he need to create a swap file, when he already has a swap partition of sufficient size?
    – Adaephon
    May 20, 2014 at 4:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .