ich bastle gerade an einem Script das mir die Installation von Debian erleichtern soll. In dem Script partitioniere ich mit fdisk. Dann lasse ich mir die erstellten Partitionen anzeigen um sie zum formatierne auswählen zu können:
so etwa:
Code: Alles auswählen
function formating() {
PARTITIONS=`find /dev/ -type b | cat`
cat << EOF
################################################################################
# Formating...
# Example of recommendet partitions:
# /dev/Xdx[0-9] /boot (100M, ext3)
# /dev/Xdx[0-9] / (15G)
# /dev/Xdx[0-9] /swap (`free -m|tail -n+2|head -n1|cut -d ":" -f 2|sed 's/^[ \t]*//g'|cut -d " " -f1`M)
# /dev/Xdx[0-9] /home (>1G)
# /dev/Xdx[0-9] /tmp (`free -m|tail -n+2|head -n1|cut -d ":" -f 2|sed 's/^[ \t]*//g'|cut -d " " -f1`M)
# /dev/Xdx[0-9] /usr (>10G)
# /dev/Xdx[0-9] /var (>10G)
# /dev/Xdx[0-9] /data (up to you)
# Be aware that FAT32 does NOT support sysmlinks NOR journaling
# Select the partitions you want to format by number:
################################################################################
EOF
fdisk -l
select partition in $PARTITIONS; do
break; done
cat << EOF
################################################################################
# Information about $partition:
################################################################################
EOF
tune2fs -l $partition
fdisk -l $partition
cat << EOF
################################################################################
# Enter the filesystemformat for $partition (ext3 is recommendet) :
################################################################################
EOF
ls -l /sbin/mkfs* | cut -d"/" -f3 | cut -d"." -f2 | tail -n +2
# add swap to the list of choices
echo "swap"
read fsformat
cat << EOF
################################################################################
# Enter a label (name) for $partition
################################################################################
EOF
read label
if [ "$fsformat" == "swap" ]; then
mkswap $partition
else
mkfs.$fsformat $partition
fi
e2label $partition $label
tune2fs -c 0 $partition
rerun_funktion_yn ${FUNCNAME}
} # end of formating
formating
Hier mal zum angucken:
Code: Alles auswählen
The number of cylinders for this disk is set to 16539.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 128.0 GB, 128035676160 bytes
240 heads, 63 sectors/track, 16539 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0x9bfb4b10
Device Boot Start End Blocks Id System
/dev/sda1 1 16539 125034808+ 5 Extended
/dev/sda5 1 14 105777 83 Linux
/dev/sda6 15 2598 19535008+ 83 Linux
/dev/sda7 2599 2857 1958008+ 83 Linux
/dev/sda8 2858 4150 9775048+ 83 Linux
/dev/sda9 4151 4280 982768+ 83 Linux
/dev/sda10 4281 5573 9775048+ 83 Linux
/dev/sda11 5574 6866 9775048+ 83 Linux
/dev/sda12 6867 16539 73127848+ 83 Linux
Command (m for help): q
################################################################################
# echo -n "Do want to keep on with partitioning? y/n :
################################################################################
n
################################################################################
# Formating...
# Example of recommendet partitions:
# /dev/Xdx[0-9] /boot (100M, ext3)
# /dev/Xdx[0-9] / (15G)
# /dev/Xdx[0-9] /swap (885M)
# /dev/Xdx[0-9] /home (>1G)
# /dev/Xdx[0-9] /tmp (885M)
# /dev/Xdx[0-9] /usr (>10G)
# /dev/Xdx[0-9] /var (>10G)
# /dev/Xdx[0-9] /data (up to you)
# Be aware that FAT32 does NOT support sysmlinks NOR journaling
# Select the partitions you want to format by number:
################################################################################
Disk /dev/sda: 128.0 GB, 128035676160 bytes
240 heads, 63 sectors/track, 16539 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0x9bfb4b10
Device Boot Start End Blocks Id System
/dev/sda1 1 16539 125034808+ 5 Extended
/dev/sda5 1 14 105777 83 Linux
/dev/sda6 15 2598 19535008+ 83 Linux
/dev/sda7 2599 2857 1958008+ 83 Linux
/dev/sda8 2858 4150 9775048+ 83 Linux
/dev/sda9 4151 4280 982768+ 83 Linux
/dev/sda10 4281 5573 9775048+ 83 Linux
/dev/sda11 5574 6866 9775048+ 83 Linux
/dev/sda12 6867 16539 73127848+ 83 Linux
Disk /dev/sdb: 8053 MB, 8053063680 bytes
218 heads, 14 sectors/track, 5153 cylinders
Units = cylinders of 3052 * 512 = 1562624 bytes
Disk identifier: 0x000555de
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 400 609279+ 83 Linux
/dev/sdb2 400 1774 2097844 83 Linux
/dev/sdb3 1775 5153 5156354 83 Linux
1) /dev/loop7 9) /dev/sdb3 17) /dev/sda7 25) /dev/ram8 33) /dev/ram14
2) /dev/loop6 10) /dev/sdb2 18) /dev/sda5 26) /dev/ram7 34) /dev/ram13
3) /dev/loop5 11) /dev/sdb1 19) /dev/sda3 27) /dev/ram6 35) /dev/ram12
4) /dev/loop4 12) /dev/sdb 20) /dev/sda4 28) /dev/ram5 36) /dev/ram11
5) /dev/loop3 13) /dev/sda10 21) /dev/sda2 29) /dev/ram4 37) /dev/ram10
6) /dev/loop2 14) /dev/sda9 22) /dev/sda1 30) /dev/ram3 38) /dev/ram1
7) /dev/loop1 15) /dev/sda6 23) /dev/sda 31) /dev/ram2 39) /dev/ram0
8) /dev/loop0 16) /dev/sda8 24) /dev/ram9 32) /dev/ram15
#? ^Cpendrive:/media/usb_data/system_setup/system_tree/usr/local/bin/myscripts/auto_debootstrep# PARTITIONS=`find /dev/ -type b | cat`
pendrive:/media/usb_data/system_setup/system_tree/usr/local/bin/myscripts/auto_debootstrep# echo $PARTITIONS
/dev/loop7 /dev/loop6 /dev/loop5 /dev/loop4 /dev/loop3 /dev/loop2 /dev/loop1 /dev/loop0 /dev/sdb3 /dev/sdb2 /dev/sdb1 /dev/sdb /dev/sda10 /dev/sda9 /dev/sda6 /dev/sda8 /dev/sda7 /dev/sda5 /dev/sda3 /dev/sda4 /dev/sda2 /dev/sda1 /dev/sda /dev/ram9 /dev/ram8 /dev/ram7 /dev/ram6 /dev/ram5 /dev/ram4 /dev/ram3 /dev/ram2 /dev/ram15 /dev/ram14 /dev/ram13 /dev/ram12 /dev/ram11 /dev/ram10 /dev/ram1 /dev/ram0
pendrive:/media/usb_data/system_setup/system_tree/usr/local/bin/myscripts/auto_debootstrep# find /dev/ -type b
/dev/loop7
/dev/loop6
/dev/loop5
/dev/loop4
/dev/loop3
/dev/loop2
/dev/loop1
/dev/loop0
/dev/sdb3
/dev/sdb2
/dev/sdb1
/dev/sdb
/dev/sda10
/dev/sda9
/dev/sda6
/dev/sda8
/dev/sda7
/dev/sda5
/dev/sda3
/dev/sda4
/dev/sda2
/dev/sda1
/dev/sda
/dev/ram9
/dev/ram8
/dev/ram7
/dev/ram6
/dev/ram5
/dev/ram4
/dev/ram3
/dev/ram2
/dev/ram15
/dev/ram14
/dev/ram13
/dev/ram12
/dev/ram11
/dev/ram10
/dev/ram1
/dev/ram0
pendrive:/media/usb_data/system_setup/system_tree/usr/local/bin/myscripts/auto_debootstrep# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda10 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8 /dev/sda9 /dev/sdb /dev/sdb1 /dev/sdb2 /dev/sdb3
pendrive:/media/usb_data/system_setup/system_tree/usr/local/bin/myscripts/auto_debootstrep# fdisk -l
Disk /dev/sda: 128.0 GB, 128035676160 bytes
240 heads, 63 sectors/track, 16539 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0x9bfb4b10
Device Boot Start End Blocks Id System
/dev/sda1 1 16539 125034808+ 5 Extended
/dev/sda5 1 14 105777 83 Linux
/dev/sda6 15 2598 19535008+ 83 Linux
/dev/sda7 2599 2857 1958008+ 83 Linux
/dev/sda8 2858 4150 9775048+ 83 Linux
/dev/sda9 4151 4280 982768+ 83 Linux
/dev/sda10 4281 5573 9775048+ 83 Linux
/dev/sda11 5574 6866 9775048+ 83 Linux
/dev/sda12 6867 16539 73127848+ 83 Linux
Disk /dev/sdb: 8053 MB, 8053063680 bytes
218 heads, 14 sectors/track, 5153 cylinders
Units = cylinders of 3052 * 512 = 1562624 bytes
Disk identifier: 0x000555de
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 400 609279+ 83 Linux
/dev/sdb2 400 1774 2097844 83 Linux
/dev/sdb3 1775 5153 5156354 83 Linux
pendrive:/media/usb_data/system_setup/system_tree/usr/local/bin/myscripts/auto_debootstrep#
Danke schon mal
