Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-04-2010, 04:05 PM   #1
Registered: Jan 2010
Distribution: centOS
Posts: 404

Rep: Reputation: 53
caution w/ cfdisk

Hi. My largest partition is currently NTFS, which I thought I could use as my Linux home directory. But when mounted to /home, "useradd -m" refuses to add new user directories. So I want to keep 10GB of that partition for Win/Linux documents and such, and use the other 42 GB for Linux users.

My question is rather easy for most of you: using cfdisk, can I just delete that partition, add two new partitions, then write the table to disk? Right now there's no data on that partition but writing the partition table seems risky--I don't want to mess with any of the other partitions (even though I can just reinstall Linux).
Old 06-04-2010, 04:22 PM   #2
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
Well of course NTFS wouldn't work right. Not being a posix-based filesystem, it doesn't have native support for *nix style permissions or ownership flags. When a Linux system accesses an NTFS drive, it has to simulate them through various mounting options.

I'm not all that familiar with cfdisk, but I don't see any real trouble with what you want to do, as long as you don't need to touch the other partitions. Things might be trickier though if you exceed the 4 primary partition limit and need to reconfigure the drive with logical partitions. Then you might have to move data around (and basically redo the entire disk). You'll certainly have to update your fstab in any case to account for the re-numbered partitions.

You might have an easier time of it using parted/gparted instead.

In any case, there's never any guarantee when it comes to partitioning and formatting disks, so you shouldn't do anything without proper backups in place. The usual rule of thumb is to never commit to any change unless you have some way to revert back if it doesn't work.
1 members found this post helpful.
Old 06-04-2010, 04:48 PM   #3
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Thanks David.

One additional question:

The partition I want to split is actually one of 3 logical partitions. So I would be changing my setup to 4. Is this also safe?
Old 06-04-2010, 05:00 PM   #4
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
You can't split partitions. You can only create, move, resize, and delete.
<end semantics>

There is no risk in creating more partitions--right up the the limit imposed by the hardware and drivers. (The normal wisdom is that SATA allows a maximum of 15, but I don't know if that's still true.)

The only other constraint has already been mentioned..........BACKUP!! (Sorry, it just popped out..)
1 members found this post helpful.
Old 06-04-2010, 05:09 PM   #5
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Logical partitions must work in a continuous chain with the ith partition carries the hard disk address of the i+1th partition.

Therefore if you delete sda7 the space is temporarily dead. The previous sda8, sda9 etc will shift up to sda7, sda8 etc.

You can actually see it occuring inside cfdisk!

If you split the dead space into two and recreate two partitions they would be sda7 and sda8. The previous sda8 and sda9 will be forced down to sda9 and sda10.

This means your logical partition device names will be shifted around.

Sata disks support 15 partitions as standard but the modern Linux kernels, newer than 2.6.28, can put 130 partitions in a Sata disk or even more if required. However not all the partitioning tools can respond beyond the 15th partitions.

Last edited by saikee; 06-04-2010 at 05:11 PM.
1 members found this post helpful.
Old 06-04-2010, 05:47 PM   #6
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
I have hda1, a "Dell Utility" partition, which I really don't know why it's there (it came w/ the computer, so I just left it--33MB).

I also have hda2 which is my Windows partition--12GB.

My 3 logical partitions include:
hda5 which is my Linux partition proper--9GB
hda6 which is my Linux swap--1GB
hda7 which is the partition I want change to 2 logical partitions--58 GB

And lastly, I have 8.23 MB of "Free Space" classified as "Pri/Log"

As such, there won't be any "shifting around," if I understand you correctly, since currently there are no partitions following the one I want to change. But if I had one following, you're saying that would be shifted up however many added partitions precede, right?
Old 06-04-2010, 07:57 PM   #7
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
If you delete hda7 and then recreate hda7 and hda8 then there is no shifting in the partitions.

The 8.23Mb may be the left over from the previous partitioning work. All partition starting from hda5 are logical and the first 4 are reserved primaries. Since you have used up hda1 and hda2 that means you hda3 has been converted to an extended partition holding hda5 to hda7. Any space left can be used for the last primary hda4 or a new logical hda8 depending on where the space is located.

Here is my sda appearing in cfdisk
                                                                                         cfdisk (util-linux-ng 2.17.2)

                                                                                             Disk Drive: /dev/sda
                                                                                     Size: 1500300828160 bytes, 1500.3 GB
                                                                            Heads: 255   Sectors per Track: 63   Cylinders: 182401

          Name                           Flags                         Part Type                  FS Type                                   [Label]                              Size (MB)
          sda1                           Boot                           Primary                   W95 FAT32 (LBA)                                                                 57585.19
          sda2                                                          Primary                   Hidden W95 FAT32 (LBA)                                                          57585.19
          sda3                                                          Primary                   Unknown (B5)                                                                    57585.19
          sda5                                                          Logical                   Linux swap / Solaris                                                             1653.29
          sda6                                                          Logical                   NTFS                                      [^F]                                  57585.19
          sda7                                                          Logical                   NTFS                                      [^F]                                  57585.19
          sda8                                                          Logical                   NTFS                                      [^F]                                  57585.19
          sda9                                                          Logical                   NTFS                                      [^F]                                  57585.19
          sda10                                                         Logical                   NTFS                                      [^F]                                  57585.19
          sda11                                                         Logical                   Linux ext3                                                                      28796.71
          sda12                                                         Logical                   Linux ext3                                                                      28796.71
          sda13                                                         Logical                   Linux ext3                                                                      28796.71
          sda14                                                         Logical                   Linux ext3                                                                      28796.71
          sda15                                                         Logical                   Linux ext3                                                                      28796.71
          sda16                                                         Logical                   Linux ext3                                                                      28796.71
          sda17                                                         Logical                   Linux ext3                                                                      28796.71
          sda18                                                         Logical                   Linux ext3                                                                      28796.71
          sda19                                                         Logical                   Linux ext3                                                                      28796.71
          sda20                                                         Logical                   Linux ext3                                                                      28796.71
          sda21                                                         Logical                   Linux ext3                                                                      16458.79
          sda22                                                         Logical                   Linux                                                                           16458.79
          sda23                                                         Logical                   Linux                                                                           16458.79
          sda24                                                         Logical                   Linux                                                                           16458.79
          sda25                                                         Logical                   Linux ext3                                                                      16458.79
          sda26                                                         Logical                   Linux ext3                                                                      16458.79
          sda27                                                         Logical                   Linux ext3                                                                      16458.79
          sda28                                                         Logical                   Linux ext3                                                                      16458.79
          sda29                                                         Logical                   Linux ext3                                                                      16458.79
          sda30                                                         Logical                   Linux ext3                                                                      16458.79
          sda31                                                         Logical                   Linux ext3                                                                       8233.51
          sda32                                                         Logical                   Linux ext3                                                                       8233.51
          sda33                                                         Logical                   Linux ext3                                                                       8233.51
          sda34                                                         Logical                   Linux ext3                                                                       8233.51
          sda35                                                         Logical                   Linux ext3                                                                       8233.51
          sda36                                                         Logical                   Linux ext3                                                                       8233.51
          sda37                                                         Logical                   Linux ext3                                                                       8233.51
          sda38                                                         Logical                   Linux ext3                                                                       8233.51                     
          sda39                                                         Logical                   Linux ext3                                                                       8233.51
          sda40                                                         Logical                   Linux ext3                                                                       8233.51
          sda41                                                         Logical                   Linux ext3                                                                       8233.51
          sda42                                                         Logical                   Linux ext3                                                                       8233.51
          sda43                                                         Logical                   Linux ext3                                                                       8233.51
          sda44                                                         Logical                   Linux ext3                                                                       8233.51
          sda45                                                         Logical                   Linux ext3                                                                       8233.51
          sda46                                                         Logical                   Linux ext3                                                                       8233.51
          sda47                                                         Logical                   Linux ext3                                                                       8233.51
          sda48                                                         Logical                   Linux ext3                                                                       8233.51
          sda49                                                         Logical                   Linux ext3                                                                       8233.51
          sda50                                                         Logical                   Linux                                                                            8233.51
          sda51                                                         Logical                   Linux ext3                                                                       8233.51
          sda52                                                         Logical                   Linux ext3                                                                       8233.51
          sda53                                                         Logical                   Linux ext3                                                                       8233.51
          sda54                                                         Logical                   Linux ext3                                                                       8233.51
          sda55                                                         Logical                   Linux ext3                                                                       8233.51
          sda56                                                         Logical                   Linux ext3                                                                       8233.51
          sda57                                                         Logical                   Linux ext3                                                                       8233.51
          sda58                                                         Logical                   Linux ext3                                                                       8233.51
          sda59                                                         Logical                   Linux ext3                                                                       8233.51
                                                                        Logical                   Free Space                                                                     346637.98                     

            [   Help   ]  [   New    ]  [  Print   ]  [   Quit   ]  [  Units   ]  [  Write   ]

                                                                                              No more partitions
                                                                                     Create new partition from free space
You will note that cfdisk has an option "quit" at the bottom of the page. Therefore you can delete and create partitions and see how they work out and select "quit" as way to study the behaviour. Until you highlight "Write" and then further confirm with a "yes" you partition table will not be changed.

Here is another case that you can have 128 partitions in a Sata if using gpt partitioning scheme.
[root@localhost saikee]# parted -l
Model: ATA SAMSUNG HD154UI (scsi)
Disk /dev/sda: 1500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  57.6GB  57.6GB  primary   fat32           boot, lba
 2      57.6GB  115GB   57.6GB  primary   fat32           hidden, lba
 3      115GB   173GB   57.6GB  primary
 4      173GB   1500GB  1328GB  extended
 5      173GB   174GB   1653MB  logical   linux-swap(v1)
 6      174GB   232GB   57.6GB  logical   ntfs
 7      232GB   290GB   57.6GB  logical   ntfs
 8      290GB   347GB   57.6GB  logical   ntfs
 9      347GB   405GB   57.6GB  logical   ntfs
10      405GB   462GB   57.6GB  logical   ntfs
11      462GB   491GB   28.8GB  logical   ext3
12      491GB   520GB   28.8GB  logical   ext3
13      520GB   549GB   28.8GB  logical   ext3
14      549GB   578GB   28.8GB  logical   ext3
15      578GB   606GB   28.8GB  logical   ext3
16      606GB   635GB   28.8GB  logical   ext4
17      635GB   664GB   28.8GB  logical   ext4
18      664GB   693GB   28.8GB  logical   ext4
19      693GB   722GB   28.8GB  logical   ext4
20      722GB   750GB   28.8GB  logical   ext3
21      750GB   767GB   16.5GB  logical   ext4
22      767GB   783GB   16.5GB  logical
23      783GB   800GB   16.5GB  logical
24      800GB   816GB   16.5GB  logical
25      816GB   833GB   16.5GB  logical   ext3
26      833GB   849GB   16.5GB  logical   ext3
27      849GB   866GB   16.5GB  logical   ext3
28      866GB   882GB   16.5GB  logical   ext3
29      882GB   898GB   16.5GB  logical   ext3
30      898GB   915GB   16.5GB  logical   ext3
31      915GB   923GB   8233MB  logical   ext3
32      923GB   931GB   8233MB  logical   ext3
33      931GB   940GB   8233MB  logical   ext3
34      940GB   948GB   8233MB  logical   ext3
35      948GB   956GB   8233MB  logical   ext3
36      956GB   964GB   8233MB  logical   ext3
37      964GB   973GB   8233MB  logical   ext3
38      973GB   981GB   8233MB  logical   ext3
39      981GB   989GB   8233MB  logical   ext3
40      989GB   997GB   8233MB  logical   ext3
41      997GB   1005GB  8233MB  logical   ext3
42      1005GB  1014GB  8233MB  logical   ext3
43      1014GB  1022GB  8233MB  logical   ext3
44      1022GB  1030GB  8233MB  logical   ext3
45      1030GB  1038GB  8233MB  logical   ext3
46      1038GB  1047GB  8233MB  logical   ext3
47      1047GB  1055GB  8233MB  logical   ext3
48      1055GB  1063GB  8233MB  logical   ext3
49      1063GB  1071GB  8233MB  logical   ext4
50      1071GB  1080GB  8233MB  logical
51      1080GB  1088GB  8233MB  logical   ext3
52      1088GB  1096GB  8233MB  logical   ext3
53      1096GB  1104GB  8233MB  logical   ext3
54      1104GB  1112GB  8233MB  logical   ext3
55      1112GB  1121GB  8233MB  logical   ext3
56      1121GB  1129GB  8233MB  logical   ext3
57      1129GB  1137GB  8233MB  logical   ext3
58      1137GB  1145GB  8233MB  logical   ext3
59      1145GB  1154GB  8233MB  logical   ext3
60      1154GB  1162GB  8233MB  logical

Model: ATA SAMSUNG HD203WI (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system     Name    Flags
 1      1049kB  10.0GB  9999MB  linux-swap(v1)  sde1
 2      10.0GB  20.0GB  9999MB  ext4            sde2
 3      20.0GB  30.0GB  9999MB  ext4            sde3
 4      30.0GB  40.0GB  9999MB  ext4            sde4
 5      40.0GB  50.0GB  10.0GB  ext4            sde5
 6      50.0GB  60.0GB  9999MB                  sde6    hidden
 7      60.0GB  70.0GB  9999MB                  sde7
 8      70.0GB  80.0GB  9999MB                  sde8
 9      80.0GB  90.0GB  10.0GB                  sde9
10      90.0GB  100GB   9999MB  ntfs            sde10   hidden
11      100GB   110GB   9999MB                  sde11
12      110GB   120GB   9999MB                  sde12
13      120GB   130GB   10.0GB                  sde13
14      130GB   140GB   9999MB                  sde14   hidden
15      140GB   150GB   9999MB                  sde15
16      150GB   160GB   9999MB                  sde16
17      160GB   170GB   10.0GB                  sde17
18      170GB   180GB   9999MB                  sde18   hidden
19      180GB   190GB   9999MB                  sde19
20      190GB   200GB   9999MB                  sde20
21      200GB   210GB   10.0GB  ntfs            sde21
22      210GB   220GB   9999MB                  sde22   hidden
23      220GB   230GB   9999MB                  sde23
24      230GB   240GB   9999MB                  sde24
25      240GB   250GB   10.0GB                  sde25
26      250GB   260GB   9999MB                  sde26   hidden
27      260GB   270GB   9999MB                  sde27
28      270GB   280GB   9999MB                  sde28
29      280GB   290GB   10.0GB                  sde29
30      290GB   300GB   9999MB                  sde30   hidden
31      300GB   310GB   9999MB                  sde31
32      310GB   320GB   9999MB                  sde32
33      320GB   330GB   10.0GB                  sde33
34      330GB   340GB   9999MB                  sde34   hidden
35      340GB   350GB   9999MB                  sde35
36      350GB   360GB   9999MB                  sde36
37      360GB   370GB   9999MB                  sde37
38      370GB   380GB   9999MB                  sde38   hidden
39      380GB   390GB   9999MB                  sde39
40      390GB   400GB   10.0GB                  sde40
41      400GB   410GB   9999MB                  sde41
42      410GB   420GB   9999MB                  sde42   hidden
43      420GB   430GB   9999MB                  sde43
44      430GB   440GB   10.0GB                  sde44
45      440GB   450GB   9999MB                  sde45
46      450GB   460GB   9999MB                  sde46   hidden
47      460GB   470GB   9999MB                  sde47
48      470GB   480GB   10.0GB                  sde48
49      480GB   490GB   9999MB                  sde49
50      490GB   500GB   9999MB                  sde50   hidden
51      500GB   510GB   9999MB                  sde51
52      510GB   520GB   10.0GB                  sde52
53      520GB   530GB   9999MB                  sde53
54      530GB   540GB   9999MB                  sde54   hidden
55      540GB   550GB   9999MB                  sde55
56      550GB   560GB   10.0GB                  sde56
57      560GB   570GB   9999MB                  sde57
58      570GB   580GB   9999MB                  sde58   hidden
59      580GB   590GB   9999MB                  sde59
60      590GB   600GB   10.0GB                  sde60
61      600GB   610GB   9999MB                  sde61
62      610GB   620GB   9999MB                  sde62   hidden
63      620GB   630GB   9999MB                  sde63
64      630GB   640GB   10.0GB                  sde64   hidden
65      640GB   650GB   9999MB                  sde65
66      650GB   660GB   9999MB                  sde66
67      660GB   670GB   9999MB                  sde67
68      670GB   680GB   10.0GB                  sde68
69      680GB   690GB   9999MB                  sde69
70      690GB   700GB   9999MB                  sde70
71      700GB   710GB   9999MB                  sde71
72      710GB   720GB   10.0GB                  sde72
73      720GB   730GB   9999MB                  sde73   hidden
74      730GB   740GB   9999MB                  sde74
75      740GB   750GB   10.0GB                  sde75
76      750GB   760GB   9999MB                  sde76
77      760GB   770GB   9999MB                  sde77
78      770GB   780GB   9999MB                  sde78
79      780GB   790GB   10.0GB                  sde79
80      790GB   800GB   9999MB                  sde80
81      800GB   810GB   9999MB                  sde81
82      810GB   820GB   9999MB                  sde82
83      820GB   830GB   10.0GB                  sde83
84      830GB   840GB   9999MB                  sde84
85      840GB   850GB   9999MB                  sde85
86      850GB   860GB   9999MB                  sde86
87      860GB   870GB   10.0GB                  sde87
88      870GB   880GB   9999MB                  sde88
89      880GB   890GB   9999MB                  sde89
90      890GB   900GB   9999MB                  sde90
91      900GB   910GB   10.0GB                  sde91
92      910GB   920GB   9999MB                  sde92
93      920GB   930GB   9999MB                  sde93
94      930GB   940GB   9999MB                  sde94
95      940GB   950GB   10.0GB                  sde95
96      950GB   960GB   9999MB                  sde96
97      960GB   970GB   9999MB                  sde97
98      970GB   980GB   9999MB                  sde98
99      980GB   990GB   10.0GB                  sde99
100     990GB   1000GB  9999MB                  sde100
101     1000GB  1010GB  9999MB                  sde101
102     1010GB  1020GB  9999MB                  sde102
103     1020GB  1030GB  10.0GB                  sde103
104     1030GB  1040GB  9999MB                  sde104
105     1040GB  1050GB  9999MB                  sde105
106     1050GB  1060GB  9999MB                  sde106
107     1060GB  1070GB  10.0GB                  sde107
108     1070GB  1080GB  9999MB                  sde108
109     1080GB  1090GB  9999MB                  sde109
110     1090GB  1100GB  9999MB                  sde110
111     1100GB  1110GB  9999MB                  sde111
112     1110GB  1120GB  9999MB                  sde112
113     1120GB  1130GB  9999MB                  sde113
114     1130GB  1140GB  10.0GB                  sde114
115     1140GB  1150GB  9999MB                  sde115
116     1150GB  1160GB  9999MB                  sde116
117     1160GB  1170GB  9999MB                  sde117
118     1170GB  1180GB  10.0GB                  sde118
119     1180GB  1190GB  9999MB                  sde119
120     1190GB  1200GB  9999MB                  sde120
121     1200GB  1210GB  9999MB                  sde121
122     1210GB  1220GB  10.0GB                  sde122
123     1220GB  1230GB  9999MB                  sde123
124     1230GB  1240GB  9999MB                  sde124
125     1240GB  1250GB  9999MB                  sde125
126     1250GB  1260GB  10.0GB                  sde126
127     1260GB  1270GB  9999MB                  sde127
128     1270GB  1280GB  9999MB  ext4            sde128  boot

[root@localhost saikee]#
The above 128 gpt partitions were created in 29 seconds with this simple script
saikee-desktop-Mint8 saikee # echo "mklabel gpt" > a2;for ((i=1;i<=180;i++)); do k1=$[(i-1)*10000+1] k2=$[i*10000]; echo "mkpart sde$i $[k1]m $[k2]m"; done >> a2 ;echo "q">>a2
saikee-desktop-Mint8 saikee # parted /dev/sdb < a2

Last edited by saikee; 06-04-2010 at 08:08 PM.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Caution Newbie Trio3b General 3 05-10-2007 02:48 PM
Caution!!!! Sid's latest Xorg may cause problems rickh Debian 14 05-03-2007 03:46 PM
Caution: Key Logger in my Computer Israfel2000 General 22 03-08-2007 06:22 PM
caution: don't buy Knoppix ashokanfarewell General 8 04-09-2006 04:48 AM
Caution about mandrake fraud eo697 General 25 11-03-2004 01:33 PM

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration